# GATE2005-14

5.9k 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

0
The given grammar is Ambiguous and left recursive....

But it's also not operator grammar

Because property is (NO two variable in right side or No null production).

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.

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.

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?

## Related questions

1
1.9k views
Consider the context-free grammar $E \rightarrow E + E$ $E \rightarrow (E * E)$ $E \rightarrow id$ where $E$ is the starting symbol, the set of terminals is $\{id, (,+,),*\}$, and the set of nonterminals is $\{E\}$. Which of the following terminal strings has more than one parse tree when parsed according to ... $id + (id* (id * id))$ $(id* (id * id)) + id$ $((id * id + id) * id)$
Consider the following expression grammar. The semantic rules for expression evaluation are stated next to each grammar production. ... to $7$ Precedence of $+$' is higher than that of $\times$', and both operators are left associative; expression is evaluated to $9$
Consider the grammar: $S \rightarrow (S) \mid a$ Let the number of states in SLR (1), LR(1) and LALR(1) parsers for the grammar be $n_1, n_2$ and $n_3$ respectively. The following relationship holds good: $n_1 < n_2 < n_3$ $n_1 = n_3 < n_2$ $n_1 = n_2 = n_3$ $n_1 \geq n_3 \geq n_2$