Thanks Sam! After fixing the String issue I found 21 new errors.. However, after knowing that the problem is an out-of-date grammar I managed to fix them too e.g. "HIDDEN" -> "Hidden" and "(CommonTree)adaptor.create(.." -> "(CommonTree)adaptor.Create(.."
Now, going to continue with my experiments :-) Laters, Mari -----Original Message----- From: Sam Harwell [mailto:[email protected]] Sent: Tuesday, August 09, 2011 4:18 PM To: 'Mari Matinlassi'; [email protected] Subject: RE: [antlr-interest] Problem when generating ANTLRv3.g for C Sharp target? Hi Mari, I've never used ANTLRv3.g, so it may have errors and it's probably not up-to-date with the latest ANTLR.g3 used in the C# port of the tool. The CSharp3 target doesn't emit a "using System;" line, so you'll need to do one of the following: 1. Change the definition of name in the scope{...} block of the rule 'rule' from String to string. 2. Add the header block: @parser::header { using System; } Sam -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Mari Matinlassi Sent: Tuesday, August 09, 2011 4:31 AM To: [email protected] Subject: [antlr-interest] Problem when generating ANTLRv3.g for C Sharp target? Dear fellows, Our research project wants to create meta-language for defining domain specific languages. And, we have chosen to take ANTLR as a tool and ANTLRv3.g as a starting point for our meta-language. Therefore, I want to generate ANTLRv3Parser.cs and ANTLRv3Lexer.cs and build them in Visual Studio (using C# target). However, I have a build error as below: "Error 1 The type or namespace name 'String' could not be found (are you missing a using directive or an assembly reference?) C:\VisualStudioProject\Testi\Testi\obj\Debug\ANTLRv3Parser.cs 2151 10 Testi" And, indeed, there is a line in ANTLRv3Parser.cs as follows: protected sealed partial class rule_scope { public String name; public rule_scope(ANTLRv3Parser grammar) { OnCreated(grammar); } partial void OnCreated(ANTLRv3Parser grammar); } Any idea what I am doing wrong? I have followed this document (http://www.antlr.org/download/CSharp3.pdf) to install and configure my Visual Studio project to work with Antlr. This works fine, thanks for excellent guide! I get a simple grammar (such as one below) to generate lexer and parser and compile them successfully. Example grammar: -----------------------------------Start of T.g----------------------------------------------------- grammar T; options { language=CSharp3; TokenLabelType=CommonToken; output=AST; ASTLabelType=CommonTree; } @lexer::namespace {ANTLRlanguage} @parser::namespace {ANTLRlanguage} public compileUnit : ('x')+ ; IDENTIFIER : ('a'..'z' | 'A'..'Z' |'_')('a'..'z' | 'A'..'Z' |'0'..'9'|'_')* ; -----------------------------------End of T.g-------------------------------------------------- Thanks for your help in advance, Mari List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address 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.
