GFG App
Open App
Browser
Continue

# GATE | GATE CS 1999 | Question 40

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

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