Antlr for multiple language generation
问题 This post about the antlr simple example shows how to create and us a grammar for java. However, this intermixes the grammar and the Java source code in the Exp.g source. My Question is, Is it possible to decouple the grammar file from the target language, so that the one grammar file can be used for generating multiple Java, Scala, C++, etc Lexers/Parsers? 回答1: It depends mostly on the reason why target code is used in the grammar. Is it only action code to do something with the found tokens