|
Example 7
|IF b THEN S
|a
The second parse, with ELSE associated with the closest IF is considered the way this should be parsed. We can rewrite this grammar to be unambiguous:
S2 -- > IF b THEN S2 ELSE S2 | a
|