26,975 views
67 votes
67 votes

Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?

  1. Removing left recursion alone
  2. Factoring the grammar alone
  3. Removing left recursion and factoring the grammar
  4. None of the above

10 Answers

4 votes
4 votes
Answer is d . Removing left recursion and left factoring is necessary but not sufficent condition for LL(1)
1 votes
1 votes
LL(1)  grammar  should be unambigous

even by eliminating leftfactoring we cannot eliminate the ambiguity

so ambigous will always there even if we convert the ambigous grammar into determistic grammar.

example:- s->iEts /iEtses/a                         s->iEtss'/a

                E->b                              =>          s'->epsilon/es

non determistic grammar                              E->b

                                                                  determisticgrammar

so by leftrecursive and factoring will not make the grammar unammbigous ....option d  is correct
0 votes
0 votes
answer - C
Answer:

Related questions

26 votes
26 votes
4 answers
1
40 votes
40 votes
3 answers
2
Kathleen asked Sep 17, 2014
19,883 views
Consider the grammar shown below. $S \rightarrow C \ C$$C \rightarrow c \ C \mid d$This grammar isLL(1)SLR(1) but not LL(1)LALR(1) but not SLR(1)LR(I) but not LALR(1)