Skip to content
Related Articles
Open in App
Not now

Related Articles

GATE | GATE CS 1999 | Question 40

Improve Article
Save Article
  • Last Updated : 30 Sep, 2020
Improve Article
Save Article

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 .

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
Related Articles

Start Your Coding Journey Now!