▲ | o11c 3 days ago | |
Dangling "else" isn't actually a problem for parser generators. All you have to do is either: * use proper rules rather than cramming everything into "statement", or * specify explicit precedence rules, which is just a shortcut for the above (also skipping useless reductions) Doing this is ubiquitous with parser generators when dealing with vaguely Algol-like languages, and is no different than the fact that you have to do the same thing for expressions. |