4.2k views

The grammar $A \rightarrow AA \mid (A) \mid \epsilon$ is not suitable for predictive-parsing because the grammar is:

1. ambiguous

2. left-recursive

3. right-recursive

4. an operator-grammar

| 4.2k views

both A and B can be answers but A is a better answer. Because we have standard procedure for removing left-recursion but ambiguity is not easy to remove. - checking if a given CFG is ambiguous is a undecidable problem.

by Boss (13.7k points)
edited by
0
Since ambiguity is undecidable problem so left recursion should be answer then, isn't it?
+1
A->AA

both left recursive and right recursive??

Any Grammar which is Left Recursive will cause any Predictive Parser to fall into an infinite loop. No matter if it is ambiguous or not, it won't be parsable. This is more stronger than saying it is ambiguous so fails.

Hence, answer = option B

by Boss (30.8k points)
+10
nopes A is a better answer.
+17
i think the precedence should go like

1) ambigious

2) left recursive

3) left factoring
0
how can it be parsed if it is ambiguous in the first place
0
It can not be parse when ambiguous. Ambiguous is more appropiate then left recursive as we can remove left recursion easily.
0
But in key answer is B
+11
There is no official answer key before GATE 2011. Which key are you talking about?
by Loyal (8.6k points)