Consider the following grammar: stmt −→ assignment −→ subr call assignment −→ id := expr subr call −→ id ( arg list ) expr −→ primary expr tail expr tail −→ op expr −→ primary −→ id −→ subr call −→ (...



Consider the following grammar:


stmt −→ assignment


−→ subr call


assignment −→ id := expr


subr call −→ id ( arg list )


expr −→ primary expr tail


expr tail −→ op expr


−→


primary −→ id


−→ subr call


−→ ( expr )


op −→ + | - | * | /


arg list −→ expr args tail


args tail −→ , arg list


−→


(a) Construct a parse tree for the input string


foo(a, b).


(b) Give a canonical (right-most) derivation of this same string.


(c) Prove that the grammar is not LL(1).


(d) Modify the grammar so that it is LL(1).



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here