Question: ` ` ` statement - > assignment | subr _ call assignment - > id: = expr subr _ call - > id ( arg

```
statement -> assignment | subr_call
assignment -> id:=expr
subr_call -> id (arg_list)
expr -> primary expr_tail
primary -> id | subr_call |(expr)
op ->+|-|*|/
arg_list -> expr arg_tail
arg_tail ->, arg_list |
a) Construct a parse tree for the input string "bar (a,b)".(10 points)
b) With the grammar above is it possible to create a parse tree for the input string "foo (a, b, d)"? If yes, construct a parse tree for the input string foo ( a, b, d). If no, explain the reason. (10 points)
c) Provide the rightmost derivation of "bar (a, b)".(10 points)
d) Explain how this grammar will not work for LL (1)?(5 points)
e) Modify the grammar so that it is LL (1).(10 points)
` ` ` statement - > assignment | subr _ call

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!