First time here? Checkout the FAQ!
+6 votes

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

asked in Compiler Design by Veteran (64.6k points)   | 1.3k views

3 Answers

+16 votes
Best answer
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.
answered by Veteran (13.4k points)  
selected by
+5 votes

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

answered by Veteran (28.7k points)  
nopes A is a better answer.
i think the precedence should go like

1) ambigious

2) left recursive

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

Related questions

Top Users Sep 2017
  1. Habibkhan

    6836 Points

  2. Arjun

    2310 Points

  3. Warrior

    2306 Points

  4. rishu_darkshadow

    2064 Points

  5. A_i_$_h

    2004 Points

  6. nikunj

    1980 Points

  7. manu00x

    1750 Points

  8. Bikram

    1744 Points

  9. SiddharthMahapatra

    1718 Points

  10. makhdoom ghaya

    1690 Points

26,038 questions
33,647 answers
31,069 users