- Bulid parsing table for grammar
S -> iSeS | iS | a
- Resolve conflicts in this table and simulate parser work for word
I know how to make a parsing table for unambiguous grammar, and how to simulate parser. However this grammar is an example of dangling else problem.
What I tried
I was tought that I should remove left recursion and left factoring. Then make a table using first and follow. Whatever I tried I got two grammar expressions in the same row of table. Please provide me some hint what to do in this situation.
After left factorization
S -> iSS' |a S'-> e S | ε
Because we will never use
S' -> ε (there are no other values which can give us
e in the
Table[S'][e] ) we can remove this production from parsing table.