Question: Use the grammar on the right to parse the stream of tokens below and draw the tree produced by parsing. a*b/(c+d)+e-f*g PROGRAM rightarrow 'program' BLOCK

Use the grammar on the right to parse the stream of tokens below and draw the tree produced by parsing. a*b/(c+d)+e-f*g PROGRAM rightarrow 'program' BLOCK BLOCK rightarrow '{' D* S*'}' D rightarrow TYPE NAME rightarrow TYPE NAME FUNHEAD BLOCK TYPE rightarrow 'int' rightarrow 'boolean' FUNHEAD rightarrow '(' (D list', ')? ')' S rightarrow 'if E 'then' BLOCK 'else' BLOCK rightarrow 'while' E BLOCK rightarrow 'return' E rightarrow BLOCK rightarrow NAME '=' E E rightarrow SE rightarrow SE '==' SE rightarrow SE '!=' SE rightarrow SE ' rightarrow NAME '(' (E list', ')? ')' rightarrow !E NAME rightarrow
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
