Question: Given the following dangling else grammar: ( 1 a ) S - > if b then S X ( 1 b ) S - >

Given the following dangling else grammar:
(1a) S -> if b then S X
(1b) S -> o
(2a) X -> epsilon
(2b) 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.1) if b then o else if b then o else o $ and
(c.2) 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 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 Databases Questions!