Question: 1 0 . Consider the following expression grammar: Terminals = { num , + , * , $ } Non - Terminals = { E

10. Consider the following expression grammar: Terminals ={num,+,*, $} Non-Terminals ={E', E} Rules = E'-> E$; E-> num; E-> E + E, E -> E * EStart Symbol = E'
a. Develop Augmented Grammar
b. Create the LR(0) states and transitions for this grammar
Since this grammar is ambiguous, it is not LR(k), for any k. We can, however, create a parsetable for the grammar, using precedence rules to determine when to shift, and when to reduce. Assuming that * binds more strongly than +, and both are left- associative, create a parse table using the LR(0) states and transitions. d. Test your parse table with the following strings
C.
num * num + num num + num * num num + num + num
e. Now create an LR parse table for this grammar, this time assuming that + binds more strongly than *, and both are right-associative. Test your parse table with the followingstrings:
num * num + num num + num * num num * num * num

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