4 ms·
A big part of why tools move away from Bison and ANTLR isn’t performance, but UX (especially error reporting)
by wwright 8y ago
A big part of why tools move away from Bison and ANTLR isn’t performance, but UX (especially error reporting)
- gnulinux 8y agoIn 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.