Question: Given the following dangling else grammar: ( 1 a ) S - > if b then S X ( 1 b ) S - >
Given the following dangling else grammar:
a S if b then S X
b S o
a X epsilon
b X else S
where terminal b stands for any boolean expression and terminal o stands for any other statement.
a Augment the grammar with a rule that includes the end of file symbol and produce NULLABLE, FIRST, and FOLLOW sets for each of the nonterminals.
b Produce the predictive parsing table. There will be a slot with with multiple entries X else S and X epsilon Remove the X epsilon entry.
c Show the parse trees obtained by predictive parsing
c if b then o else if b then o else o $ and
c if b then if b then o else o $
solve this question by hand on paper. please define each step briefly.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
