hello, I am trying to generate C# code from my grammar for use with Mono2 (v1.9).
I tried to use the C# runtime binaries (ANTLR-3.1-2009-06-28.7z): $ cd ANTLR-binary/ $ mono Antlr3.exe ** (Antlr3.exe:4230): WARNING **: Missing method System.Reflection.Emit.DynamicMethod::.ctor(string,Type,Type[]) in assembly /usr/lib/mono/2.0/mscorlib.dll, referenced in assembly /home/felix/doks/CSMath/ANTLR/ANTLR-binary/Antlr3.StringTemplate.dll Unhandled Exception: System.TypeInitializationException: An exception was thrown by the type initializer for Antlr3.Tool.ErrorManager ---> System.TypeInitializationException: An exception was thrown by the type initializer for Antlr3.ST.StringTemplateGroup ---> System.MissingMethodException: Method not found: 'System.Reflection.Emit.DynamicMethod..ctor'. at Antlr3.ST.StringTemplateGroup..cctor () [0x00000] --- End of inner exception stack trace --- [...] I also tried to recompile the Runtime: ---------------------- $ cd antlr-3.3/runtime/CSharp2/ $ nant clean NAnt 0.85 (Build 0.85.2478.0; release; 14.10.2006) Copyright (C) 2001-2006 Gerry Shaw http://nant.sourceforge.net Buildfile: file:///home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/all.antlr3.runtime.net.build Target framework: Mono 2.0 Profile Target(s) specified: clean clean: [delete] Deleting directory '/home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/bin'. [delete] Deleting directory '/home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/build/mono-2.0'. BUILD SUCCEEDED Total time: 0.1 seconds. ---------------------- ---------------------- $ $ nant build NAnt 0.85 (Build 0.85.2478.0; release; 14.10.2006) Copyright (C) 2001-2006 Gerry Shaw http://nant.sourceforge.net Buildfile: file:///home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/all.antlr3.runtime.net.build Target framework: Mono 2.0 Profile Target(s) specified: build clean: init: [mkdir] Creating directory '/home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/bin'. [mkdir] Creating directory '/home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/build/mono-2.0'. copy_build_dependencies: [copy] Copying 3 files to '/home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/build/mono-2.0'. build.v3.runtime: [nant] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/default.build build Buildfile: file:///home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/default.build Target framework: Mono 2.0 Profile Target(s) specified: build [tstamp] 1. März 2011 21:05:34. [echo] Building project: 'Antlr3.Runtime' version 3.1b1 ==> 'Antlr3.Runtime.dll' clean: copy_build_dependencies: [copy] Copying 3 files to '/home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/bin'. init: [mkdir] Creating directory '/home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/bin/tests'. compile: [csc] Compiling 105 files to '/home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/bin/Antlr3.Runtime.dll'. [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime/CommonToken.cs(115,0): warning CS1587: XML comment is not placed on a valid language element [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime/Lexer.cs(61,0): warning CS1587: XML comment is not placed on a valid language element [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime/Lexer.cs(68,0): warning CS1587: XML comment is not placed on a valid language element [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime/Lexer.cs(161,0): warning CS1587: XML comment is not placed on a valid language element [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime/Lexer.cs(266,0): warning CS1587: XML comment is not placed on a valid language element [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/ITreeNodeStream.cs(44,9): warning CS1587: XML comment is not placed on a valid language element [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(40,21): error CS0246: The type or namespace name `IAstRuleReturnScope`1' could not be found. Are you missing a using directive or an assembly reference? [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(40,16): error CS0234: The type or namespace name `Func`1' does not exist in the namespace `System'. Are you missing an assembly reference? [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(41,21): error CS0246: The type or namespace name `IAstRuleReturnScope`1' could not be found. Are you missing a using directive or an assembly reference? [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(41,16): error CS0234: The type or namespace name `Func`1' does not exist in the namespace `System'. Are you missing an assembly reference? [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(54,63): error CS0246: The type or namespace name `IAstRuleReturnScope`1' could not be found. Are you missing a using directive or an assembly reference? [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(54,58): error CS0234: The type or namespace name `Func`1' does not exist in the namespace `System'. Are you missing an assembly reference? [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(86,69): error CS0246: The type or namespace name `IAstRuleReturnScope`1' could not be found. Are you missing a using directive or an assembly reference? [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(86,64): error CS0234: The type or namespace name `Func`1' does not exist in the namespace `System'. Are you missing an assembly reference? [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(105,24): error CS0246: The type or namespace name `IAstRuleReturnScope`1' could not be found. Are you missing a using directive or an assembly reference? [csc] Compilation failed: 10 error(s), 6 warnings [csc] /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/Antlr.Runtime.Tree/TreeRewriter.cs(109,24): error CS0246: The type or namespace name `IAstRuleReturnScope`1' could not be found. Are you missing a using directive or an assembly reference? BUILD FAILED - 0 non-fatal error(s), 16 warning(s) /home/felix/doks/CSMath/ANTLR/antlr-3.3/runtime/CSharp2/Sources/Antlr3.Runtime/default.build(83,4): External Program Failed: /usr/lib/mono/2.0/gmcs.exe (return code was 1) Total time: 0.7 seconds. BUILD FAILED ---------------------- Next I tried to copy over the generated Lexer + Parser (with options {language=CSharp2;}) to a C# Project (using Monodevelop) and reference Antlr3.Runtime.dll in the solution. But then I get these errors (I guess this is because the c#-runtime-binaries are for antlr 3.1): ---------------------- /home/felix/doks/CSMath/CSAnalysis/simpleexprLexer.cs(1136,40): error CS0115: `simpleexprLexer.DFA10.Description' is marked as an override but no suitable property found to override /home/felix/doks/CSMath/CSAnalysis/simpleexprLexer.cs(1220,40): error CS0115: `simpleexprLexer.DFA13.Description' is marked as an override but no suitable property found to override /home/felix/doks/CSMath/CSAnalysis/simpleexprLexer.cs(18,22): warning CS3021: `simpleexprLexer' does not need a CLSCompliant attribute because the assembly is not marked as CLS-compliant /home/felix/doks/CSMath/CSAnalysis/simpleexprLexer.cs(68,6): error CS0246: The type or namespace name `GrammarRule' could not be found. Are you missing a using directive or an assembly reference? /home/felix/doks/CSMath/CSAnalysis/simpleexprLexer.cs(77,17): error CS0103: The name `DebugEnterAlt' does not exist in the current context /home/felix/doks/CSMath/CSAnalysis/simpleexprLexer.cs(80,17): error CS0103: The name `DebugLocation' does not exist in the current context /home/felix/doks/CSMath/CSAnalysis/simpleexprLexer.cs(98,6): error CS0246: The type or namespace name `GrammarRule' could not be found. Are you missing a using directive or an assembly reference? /home/felix/doks/CSMath/CSAnalysis/simpleexprLexer.cs(107,17): error CS0103: The name `DebugEnterAlt' does not exist in the current context /home/felix/doks/CSMath/CSAnalysis/simpleexprLexer.cs(110,17): error CS0103: The name `DebugLocation' does not exist in the current context [...] ---------------------- Note that there is using Antlr.Runtime; at the top of simpleexprLexer.cs. Previous postings suggest that the C# Target should work out of the box with Mono. I am using Mono 1.9 (Debian Lenny). Sorry for the verbosity and thanks in Advance! -- Felix Natter List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
