Question: Question 4 : ( 2 0 points ) Consider the following grammar: E - > E + T | T T - > T *

Question 4: (20 points)
Consider the following grammar:
E->E+T|T
T->T*F|F
F->(E)| id
In class, we used an LR parser to shift and reduce the following expression "id + id * id".
a) Can you use the current grammar with an LL(1) parser for the expression id + id * id? Explain your answer.
b) If LL(1) parser cant be used fix the grammar (also show the fixed grammar) and show your parse tree. If grammar doesnt need to be fixed, only show the parse tree.
Question 4 : ( 2 0 points ) Consider the

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 Programming Questions!