in Compiler Design retagged by
12,511 views
2 votes
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..???

in Compiler Design retagged by
12.5k views

1 Answer

0 votes
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 :)

3 Comments

Ok.. I am writing my question again please see this and answer if you know..!!
0
0
Ya sure :)
0
0
Done from my side, now you can read question again
0
0