Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

GATE | GATE CS 1999 | Question 40

  • Last Updated : 30 Sep, 2020

A grammar that is both left and right recursive for a non-terminal is
(A) Ambiguous
(B) Unambiguous
(C) Information is not sufficient to decide whether it is ambiguous or Unambiguous.
(D) None of the above

Answer: (C)

Explanation: Suppose we have grammar like this :

S → n
B → BbB 

Here we see that grammar is left as well as right recursive but still it is unambiguous grammar because A is useless production but it is still part of grammar.
So we can say that a grammar having both left as well as right recursion may or may not be ambiguous .

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

Lets understand with another example as we have grammar like this A→AA using this grammar we can not produce any string in finite steps as language of this grammar is empty set {}.
Hence, we finally get conclusion as if grammar is having both left as well as right recursion, then grammar may or may not be ambiguous.

Option (C) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :