Hacker News new | ask | show | jobs
by veltas 1745 days ago
> Each of the major steps have tools available that will do 90% of the work for you. On the lexer/parser side there’s ANTLR4, bison, yacc, flex.

In my experience, those tools will do like 10% of the work of lexing or parsing for you, and you will spend equivalent to 20% of the work understanding how to use them and integrating them. And then you'll find out a sad hand-written recursive descent parser is faster in practice and is what e.g. GCC and clang use.

1 comments

It's true that a hand-written recursive parser is better for a real compiler, but the main reason is that it's much easier to write sensible error messages that way. Parser generators are only really good at the happy path.