GATE | GATE-CS-2005 | Question 14
The grammar A → AA | (A) | ε is not suitable for predictive-parsing because the grammar is
(D) an operator-grammar
Explanation: Since given grammar can have infinite parse trees for string ‘ε’, so grammar is ambiguous, and also A → AA has left recusion.
For predictive-parsing, grammar should be:
- Free from ambiguity
- Free from left recursion
- Free from left factoring
Given grammar contains both ambiguity and left factoring, so it can not have predictive parser.
We always expect first grammar free from ambiguity for parsing. Option (A) is more strong option than option (B) here.
Quiz of this Question