Sunday, 17 May 2015

Q 7,paper2, D 12.The ‘C’ language is


(A) Context free language
(B) Context sensitive language
(C) Regular language
(D) None of the above
Answer(A)
Context sensitive grammar would allow productions like:
a N c ::= a b c
whereas the non-terminal N would be reduced to token b if and only if it appears in the context of a and c.Productions of common programming languages never appear in a context, that means, they form context-free grammars. On the contrary side if we take example of C++ ,
int a(d) .
is context sensitive because if d is a variable then ‘a’ is declared with integer type and initial value d.if d is a data type then a is a function whose return type is integer and parameter of type d is passed. This is in case of C++, not in c. Hence we can say c is context free language.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.