Consider the following grammar : stmt assignment subr_call assignment id := expr subr call

Question:

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).

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: