• retagged by
18,043 views
2 2 votes

The LL(1) parsing table for the above grammar is 

Nonterminal a b e i t $
S S->a     S->iEtSS'    
S'    

S' ->epsilon

S' ->es

    S'->epsilon
E   E->b        

By looking the parse table we found multiple entries in M [S',e] hence Grammar is not LL(1).

Now suppose I have to make a LL(1) parser but here I found grammar is ambiguous so I have to remove this ambiguity otherwise we are not able to make LL(1) parser for this grammar .In order to remove ambiguity from grammar we always choose  the production S' ->eS to be present in parse table and remove  S' ->epsilon and make it LL(1). So my question is WHY we always choose S' ->eS production to remain in this parse table why not S' -> epsilon? Answer this..???

1 Answer

0 0 votes

Hi i think s--> ietss'

s'-->es / epsilon  ( you have mentioned S --es )see above 

E--> b 

But apart from that the LL1 table that you constructed is wrong 

On top you have terminals along with $ . You have an entire coloumn for epsilon which is wrong 

In LL 1 when ever we have NT --->∈  so in such case we find follow( NT ) , and what ever value we get ( say we get a and b ) under a and b which are terminals  we will put the NT --->∈ .

And i dont undersatnd your last statement can you elaborate it more :) 

whereas For epsilon thing it has nothing to do with ambiguity . In ll1 we are looking 1 look ahead symbol then accordingly we will use production ( in top down manner ) . So according to looakahead symbol we have to use which production is summarized here :)

Position:
Show:

Related questions

3 3 votes
2 answers 2 answers
2.9k
2.9k views
1 1 vote
1 1 answer
1.3k
1.3k views
0 0 votes
1 1 answer
1.2k
1.2k views
KISHALAY DAS asked Nov 9, 2016
1,224 views
Which of the following statements is true?Every LR(0) grammar is also SLR(1)An ambiguous grammar can never be LR grammarEvery LL(1) grammar is also an LALR(1)All of these