Question: [ 0 5 ] Using the Bottom - UP parsing ( syntactical analysis ) algorithm, trace the first 5 iterations of the parser given the

[05] Using the Bottom-UP parsing (syntactical analysis) algorithm, trace the first 5 iterations of the parser given the input: "(a+b)**(c+d)$ " Show only the contents of the STACK each iteration.
(S0,a1dotsanS)// The parser at initial configuration =(stack, input)
state# =0, action =-, stack =[0]
while( action "accept" & action error )
3.1 state# = stack right, nextToken = input left
Grammar
3.2 Find action
3.2.1 action = ActionTable[ row=state#, cohmnn=nextToken ]
3.2.2 state #= the index part of the action e.g. if action ?T=R3=> state #=3
EE+T
ET
3.3 if action =S)
// Shift
3.3.1 Push nextToken and state"
else
// Reduce
TT**F
TF
3.3.2 Remove top of the stack token and its state#
F(E)
3.3.3 Exposed state, x State ?E= current stack right statel" after 3.3.2
F id
3.3.4 Push the LHS nonterminal of the rule of the removed token in 33.2
3.3.5 state = GOTOTable[ xStae# in 3.3.3. LHS in 3.3.4]
3.3.5 Push the state
endIF
// If action == void cell error
3.4 if (any error detected )
3.4.1 handleError( errorType )
3.4.2 error = TRUE
endIF
\table[[Sute,Terminals,Non-Terminals],[Action,Coto],[ld,*,-,1,),s,E,T,r],[0,ss,,,SA,,,1,2,3],[1,,$6,,,,sccept,,,],[2,,R,57,,122,R2,,,],[3,,RA,RA,,R4,R4,,,],[4,ss,,,s4,,,8,2,3],[5,,RS,126,,R6,RS,,,],[6,ss,,,SA,,,,9,3],[7,SS,,,si,,,,,10],[8,,56,,,511,,,,]]
 [05] Using the Bottom-UP parsing (syntactical analysis) algorithm, trace the first

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!