我正在尝试构建以下存储库中可用的 Antlr V4 语法: https: //github.com/antlr/grammars-v4。我已经成功构建了 Python3 和 Java 语法,并且目标 *.java 文件已成功生成。但是,当我尝试构建 C# 语法(例如 CSharpLexer.g4、CSharpParser.g4 和 CsharpPreporcessorParser.g4)时,我收到构建错误。它会生成以下错误:
error(114): CSharpPreprocessorParser.g4:7:21: cannot find tokens file ./CSharpLexer.tokens
error(126): CSharpParser.g4:20:62: cannot create implicit token for string literal in non-combined grammar: '.'
error(126): CSharpParser.g4:25:14: cannot create implicit token for string literal in non-combined grammar: '?'
error(126): CSharpParser.g4:25:37: cannot create implicit token for string literal in non-combined grammar: '*'
error(126): CSharpParser.g4:31:8: cannot create implicit token for string literal in non-combined grammar: '*'
error(126): CSharpParser.g4:71:3: cannot create implicit token for string literal in non-combined grammar: '<'
error(126): CSharpParser.g4:71:14: cannot create implicit token for string literal in non-combined grammar: ','
error(126): CSharpParser.g4:71:25: cannot create implicit token for string literal in non-combined grammar: '>'
error(126): CSharpParser.g4:76:14: cannot create implicit token for string literal in non-combined grammar: ','
error(126): CSharpParser.g4:80:15: cannot create implicit token for string literal in non-combined grammar: ':'
error(126): CSharpParser.g4:99:3: cannot create implicit token for string literal in non-combined grammar: '='
error(126): CSharpParser.g4:99:9: cannot create implicit token for string literal in non-combined grammar: '+='
error(126): CSharpParser.g4:99:16: cannot create implicit token for string literal in non-combined grammar: '-='
error(126): CSharpParser.g4:99:23: cannot create implicit token for string literal in non-combined grammar: '*='
error(126): CSharpParser.g4:99:30: cannot create implicit token for string literal in non-combined grammar: '/='
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用 Antlr V4 eclipse 插件构建它。我的目标是生成 *.java 文件以继续后续步骤。不确定如何构建所有 csharp *.g4 文件,因为 Java 和 Python 分别只有一个语法文件。
首先构建 CSharpLexer.g4。然后构建 CSharpParser.g4 和 CsharpPreporcessorParser.g4。构建 CSharpLexer.g4 将生成 CSharpLexer.tokens,供 CSharpParser.g4 的后续阶段使用。
归档时间: |
|
查看次数: |
346 次 |
最近记录: |