A grammar that is both left and right recursive for a non – terminal, is
A grammar that is both left and right recursive for a non – terminal, is
Answer: A. Ambiguous — A grammar that is both left and right recursive for a non-terminal can generate the same string through multiple derivation paths, leading to ambiguity. This…
- A.
Ambiguous
- B.
Unambiguous
- C.
information is not sufficient to decide
- D.
None of these
Attempted by 349 students.
Show answer & explanation
Correct answer: A
A grammar that is both left and right recursive for a non-terminal can generate the same string through multiple derivation paths, leading to ambiguity. This occurs because left recursion allows derivations starting from the left, while right recursion starts from the right, and their combination often results in multiple valid parse trees for the same input. Therefore, such grammars are inherently ambiguous.