Question: 5. Consider the grammar: (1) E E+T|T (2) T T*F|F (3) F (E) | id (a) Give a rightmost derivation for the sentence w=id *

5. Consider the grammar: (1) E E+T|T (2) T T*F|F (3) F (E) | id (a) Give a rightmost derivation for the sentence w=id * (id + id) * id + id. (b) Give a left most derivation for the same string w. (c) The above grammar is left recursive. One way of eliminating left recursion is to replace productions of the form: A A a B, where does not begin with an A, by the productions: A BA' ' ' | . Transform the above grammar into one without left recursion using this technique
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
