Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[ 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,,,,]]
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What are the objectives of job evaluation ?

Answered: 1 week ago

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago