Nov 16, 2013

Antlr for C# target generates XXXLexer.java file instead of XXXLexer.cs

I encountered an issue that Antrl4 generates java source code of Lexer instead of c-sharp source code. It turned out that it is a bug in the Antlr4 tool.

Instead of using "options{ language=CSharp_v4_5 }", the target language name should be passed into the tool as an input argument: http://stackoverflow.com/questions/17873164/antlr4-generating-lexer-in-java-instead-of-c-sharp.
java org.antlr.v4.Tool %* -Dlanguage=CSharp_v4_5
With the argument, it generated .cs version of Lexer.

No comments: