Question: Consider the following grammar : stmt assignment subr_call assignment id := expr subr call id ( arg list ) expr
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 arg_ 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).
Step by Step Solution
3.49 Rating (159 Votes )
There are 3 Steps involved in it
a b stmt subr call id arg list id expr args tail id expr arg list id expr expr args tail id expr ex... View full answer
Get step-by-step solutions from verified subject matter experts
