Question: Consider the following grammar: stmt rightarrow assignment rightarrow subr_call assignment rightarrow id:= expr subr_call rightarrow id (arg_list) expr rightarrow primary expr_tail expr_tail rightarrow op expr

Consider the following grammar: stmt rightarrow assignment rightarrow subr_call assignment rightarrow id:= expr subr_call rightarrow id (arg_list) expr rightarrow primary expr_tail expr_tail rightarrow op expr rightarrow epsilon primary rightarrow id rightarrow subr_call rightarrow (expr) op rightarrow + | - | * |/arg_list rightarrow expr args_tail args_tail rightarrow, arg_list rightarrow epsilon (a) Construct a parse tree for the input string foo (a, b). (b) Give a canonical (rightmost) 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
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
