Re:GNU Bison 3.3 released
by wwright on Saturday January 26, 2019 @07:02PM
(#19009410)
A big part of why tools move away from Bison and ANTLR isn’t performance, but UX (especially error reporting)
[ Parent
| on HN ]
In my experience recursive descent doesn't have any better error reporting than Bison or ANTLR. Parser combinators are much better if error reporting is what you're aiming for. Also, for LALR/LR parsers like Bison/ANTLR, the canonical trick is to encode errors in your grammar, which really isn't a huge deal. E.g. in pseudocode
suite: stmt ';' stmt {/* ok */}
| one_line_stmt NEWLINE stmt {raise("you need a ';' there buddy");}
| // other rules
;
obviously this won't be useful for every case in general, otherwise why use ';' at all, but in most cases it'll give a helpful error.Some more powerful parsers like Earley Algorithm have much worse error reporting.