retagged by
352 views

2 Answers

0 votes
0 votes
Consider the following grammar:

E → E + n | E * n |  n

and a right-most derivation is as follows:

E → n + E  → n + E * n→ n + n * n

The n’s are subscripted for notational convenience.

Note that the reduction is in the opposite direction from n+ n* n back to E, where the handle at every step
0 votes
0 votes

during input scanning ..when we found the string which can directly reduced to production variable...such part is called as handle...

now look at you string n+n*n;...

now when we read n then there is possible reduction from n to E...so first handle is 'n'..

now we have replace it with E...so we get E+n*n...now we continue scan and we can see that E+n is another one that can be reduce to E...so our next handle is E+n......so replace E+n with E only ..

now we have E*n....this is also one more handle as it can be directly reduct to E....

SO ALL HANDLES WE GET IN SEQUENCE ARE 

n , E+n , E*n

Related questions

0 votes
0 votes
2 answers
1
Jayant Isswani asked May 2, 2018
569 views
Can the following grammar be parsed by LR(0) parser?E - E+id | idIs the accept state entry considered on all the terminal symbol columns for LR(0) parser?
0 votes
0 votes
1 answer
4
admin asked Aug 20, 2019
740 views
Show that the following grammar$S\rightarrow Aa\mid bAc\mid Bc\mid bBa$$A\rightarrow d$$B\rightarrow d$is LR(1) but not LALR(1).