Question: 9. [20 points) Proper parsing A simple grammar generating arithmetic expressions formed with binary non- negative integers with and * is the following. S (S)

9. [20 points) Proper parsing A simple grammar generating arithmetic expressions formed with binary non- negative integers with and * is the following. S (S) S+SSSN N ON 1N 01 Design a grammar for the same language, which is useful for a compiler. Any occurrence of a variable in a derivation should generate a subexpression that has to be computed to evaluate the arithmetic expression. Obviously, * precedence over +, i.e., * binds stronger than +. Equal operations are evaluated from left to right if there are no parentheses. Example: In 1+ 10 * 10+1+1, neither 1 + 10 nor 1+1 should be generated from a subtree of the parse tree
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
