Nov 16, 2013

Antlr for C# target generates 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:
java org.antlr.v4.Tool %* -Dlanguage=CSharp_v4_5
With the argument, it generated .cs version of Lexer.

No comments: