I want to convert this grammar to an unambiguous grammar:
S -> if E then S
| if E then S else S
| a
E -> b
I found a solution which is more complicated than my solution but I'm not sure if my solution is correct:
S -> if E then T else S
| if E then S
| a
T -> if E then T else T
| a
E -> b
So is my solution correct?