retagged by
4,111 views
2 votes
2 votes
Consider the following LL(1) grammar.
E → TE′
E′ → + E|ε
T → FT′
T′ → T|ε
F → GF′
F′ → *F′|ε
G → (E)|a|b|c
Initially stack contains two symbols. Bottom of stack symbol is $ and top of stack (above $) symbol is E where E is start symbol of the grammar. The number of symbols on the stack after the sixth action taken by LL(1) parser to parse the input “ab*” are ______.
retagged by

2 Answers

1 votes
1 votes

I guess, 3 should be the correct answer.

And the content of the stack should be T'E'$.

Here is the complete parsing of "ab*":

0 votes
0 votes
Grammar is LL(1) so fo paerse string 'ab*' Productions are :

E$ ---> TE'$ ---> FT'E'$ ---> GF'T'E'$ ---> aF'T'E'$ ---> aT'E'$ ---> aTE'$ ---> aFT'E'$ ---> aGF'T'E'$ ---> abF'T'E'$ ---> ab*F'T'E'$ ---> ab*T'E'$ ---> ab*E'$ ---> ab*$

 

See content of stack after 6th operation .. it is { T', E', $ }

Related questions

2 votes
2 votes
2 answers
1
2 votes
2 votes
2 answers
2
kallu singh asked Sep 5, 2017
644 views
Q if any Grammar is LL(1) definitely LALR(1) ?It is true or falsePlease ans explain in detail.
2 votes
2 votes
1 answer
4
sripo asked Nov 10, 2018
3,182 views
Can you give an example which is not LL(1) but is CLR(1)