Reputation: 21
Recently I picked up a copy of The Definitive ANTLR 4 Reference and since I am sophisticated when it comes to working with grammars and languages I wanted to work on my DSL I once have written using yacc and bison. The general idea is to write a translator (with included validation for type safety(1)) which translates the DSL to JavaScript during runtime which is then executed by v8.
Although ANTLR was designed for inclusion in Java applications I would like to stay with native C++. Can ANTLR 4 produce such a C parser/lexer(2) which I can include using a C++-style wrapper? And how to do so?
Upvotes: 2
Views: 771
Reputation: 249123
Yes, ANTLR 4 can target C++: https://github.com/antlr/antlr4/blob/master/doc/cpp-target.md
So could ANTLR 2. There were some dark days in between when ANTLR 3 could not target C++, but thankfully those are behind us now.
Upvotes: 2