问题
I am following the tutorial at: http://www.antlr.org/wiki/pages/viewpage.action?pageId=557075
When I get to step 11, compile with VS I am getting the following:
Error The type or namespace name 'AstParserRuleReturnScope' could not be found
Error The type or namespace name 'GrammarRule' could not be found
Error The type or namespace name 'GrammarRuleAttribute' could not be found
etc.
Any tips from anyone? There is little to no documentation to help me here.
Thanks!
回答1:
Use ANTLRWorks 1.4 to generate the code if you are using the compiled runtime dlls. Otherwise, if you use the latest version of ANTLRWorks I believe you need to get the latest version of the runtime and compile it.
回答2:
You most likely just need a more recent version of the ANTLR .NET runtime. The latest version can be found at: http://www.antlr.org/wiki/display/ANTLR3/Antlr3CSharpReleases
ANTLR version 3.4.1 has been working for me with ANTLRWorks 1.4.3 parsers & lexers; before upgrading the runtime, I was getting the same errors as you.
来源:https://stackoverflow.com/questions/7614953/antlr-c-sharp-errors-when-integrating-into-vs2008