Question: Write a program that constructs the ACTION and GOTO parse tables for an SLR parser. Method for doing this is algorithm 4.46 (Purple Dragon Book)

Write a program that constructs the ACTION and GOTO parse tables for an SLR parser. Method for doing this is algorithm 4.46 (Purple Dragon Book) pg 253, Algorithm 4.8 (Red Dragon Book), pg 227. Algorithm to do this is briefly described in Feb 16 notes, Shift-Reduce parser that uses these tables is described in Feb 9 notes. Once you have the ACTION and GOTO tables, it is easy to construct your own SLR parser. Given your program, construct the SLR parse tables for the augmented expression grammar: S -> E E -> E + T E -> T T -> T * F T -> F F -> i F -> (E) Input format should be the same as for Lab6:define your own output format. Report if any states contain shift-reduce or reduce-reduce conflicts. Resolve all shift-reduce conflicts (if any) in favor of shift Answer the questions: Is the given expression grammar in SLR? If there were shift-reduce conflicts, your program should set the state where the conflict occurs to SHIFT - this is what YACC does, and it works much of the time. Will this default action be correct in this case (assuming the grammar was not SLR)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
