Came home and tried again with a clearer head.
And this time I found my missing ';' plus many other syntax errors ;)
The build action for VS2010 MSBuild works great too!!! All compiled and 
executed perfectly!!

parser  grammar XMLParser;options{    language=CSharp3;    tokenVocab=XMLLexer;}
@header {using System;}@namespace { XMLParserN }
public document  : element ;
element    : startTag         (element        | PCDATA        )*        endTag  
  | emptyElement    ;
startTag        : TAG_START_OPEN GENERIC_ID {Console.Write(@"<" + 
$GENERIC_ID.text); } (attribute )*      TAG_CLOSE {Console.Write(@">"); }     ;
attribute       : GENERIC_ID ATTR_EQ ATTR_VALUE                 { if 
($GENERIC_ID.text=="class") Console.Write(@" class=" + $ATTR_VALUE.text); }     
   ;
endTag  : TAG_END_OPEN GENERIC_ID TAG_CLOSE     {Console.WriteLine(@"</" + 
$GENERIC_ID.text + @">"); }  ;               
emptyElement : TAG_START_OPEN GENERIC_ID  (attribute)* TAG_EMPTY_CLOSE ;
> From: [email protected]
> To: [email protected]
> Date: Wed, 8 Jun 2011 13:09:00 -0500
> Subject: Re: [antlr-interest] Something in my little grammar throws an Unable 
> to cast CommonTree to type GrammarAST
> 
> 
> Thanks Jim,
> I looked at " XMLParser.g:29:11" before doing the first post. That pointed me 
> to "returns" in this rule. My only idea is that there is something I need to 
> do at the top of the grammar definition, like set output to AST. Before using 
> "returns". At that point I started to "backtrack" and looked at the rest of 
> the stack.
> I am still stuck.
> attribute returns [string cl] : GENERIC_ID ATTR_EQ ATTR_VALUE
> 
> 
                                          

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.

Reply via email to