3 ms·
> You also need to decide whether to write your own parser and lexer or use automatic parser and scanner generators (e.g. flex and bison). Really? There are mu
by CalChris 9y ago
> You also need to decide whether to write your own parser and lexer or use automatic parser and scanner generators (e.g. flex and bison).
Really? There are much better choices available in 2017. ANTRL 4 leaps to mind which has been in development since 1989.
- chubot 9y agoANTLR is really only good for the Java ecosystem. The quality of the generated C/C++ code is low and it has a large number of dependencies. C++ development also lagged pretty far behind Java when ANTLR 4 was released. I don't know of any "real" language written in C or C++ that uses ANTLR. The state of the art for production languages in C/C++ is either hand-written parsers or yacc/bison. I've never even seen flex used, and I've looked at over 20 lexer/parser implementations for "real" languages.
- CalChris 9y agoJava, C#, Go, Python, JavaScript, Swift and C++ although everything gets started with Java and filled out to the other targets. You may be thinking of ANTRL 3. I really didn't much care for the ANTLR 3 C target but I use ANTRL 4 and its C target. It is really much much better than ANTRL 3. TParr says ANTLR 4 is the parser generator he always wanted to make. However, I'm not still pitching ANTRL as a parser for a real compiler. ANTRL rules the world for little languages, domain specific languages but a production language would almost certainly would use a hand crafted recursive decent compiler. This is a learning project. So I'd strongly recommend anyone learn modern tools and methods and learn those. bison is C++ native with experimental Java support and nothing else. flex is C and C++ only. Not a fan.
- pjmlp 9y agoAnother good one is JavaCC, but not at the same level as ANTRL.