我尝试更新一个Antlr3语法文件,用于将我们自己的DSL解析为新的Antlr4格式。
在消除AntlrWorks2中的所有语法错误之后,我将此语法集成到Visual Studio 2013测试项目中,该测试项目包含Antlr 4.3.0 C#目标运行时库。 但是我在编译这个语法时只能跟随callstack:
未知的构建错误:
Executing command: "C:\Program Files (x86)\Java\jre1.8.0_31\bin\java.exe" -cp D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\..\tools\antlr4-csharp-4.3-complete.jar org.antlr.v4.CSharpTool -o obj\Debug\ -listener -visitor -Dlanguage=CSharp_v4_5 -package Antlr4Test D:\Projects\Antlr4Test\Antlr4Test\UpsSharp.g4 (TaskId:10)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: Exception in thread "main" java.lang.NullPointerException
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.automata.ParserATNFactory.elemList(ParserATNFactory.java:490)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.automata.ParserATNFactory.alt(ParserATNFactory.java:477)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.parse.ATNBuilder.alternative(ATNBuilder.java:556)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.parse.ATNBuilder.ruleBlock(ATNBuilder.java:290)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.automata.ParserATNFactory._createATN(ParserATNFactory.java:186)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.automata.LexerATNFactory.createATN(LexerATNFactory.java:134)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.Tool.processNonCombinedGrammar(Tool.java:405)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.Tool.process(Tool.java:376)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.Tool.processGrammarsOnCommandLine(Tool.java:343)
1>D:\Projects\Antlr4Test\packages\Antlr4.4.3.0\build\Antlr4.targets(132,5): error AC1000: Unknown build error: at org.antlr.v4.CSharpTool.main(CSharpTool.java:59)
1>Done executing task "Antlr4ClassGenerationTask" -- FAILED. (TaskId:10)
尝试编译示例语法工作正常! 我们对Antlr没有多少经验,只想更新到Antlr4,所以也许有人知道会发生什么?
提前致谢! 霍尔格