[antlr-interest] ^(TOKEN) vs. TOKEN

Terence Parr parrt at cs.usfca.edu
Sun Mar 1 10:21:29 PST 2009


sorry about that. ^(P) isn't a tree.  Trees are nodes or subtrees with  
root/children.
Ter
On Feb 28, 2009, at 10:56 PM, Gary R. Van Sickle wrote:

> Hi guys,
>
> Can somebody explain to me why this is ok in a parser grammar:
>
> pointer
> 	: '*' -> ^(POINTER)
> 	;
>
> But this is an error in a tree grammar?:
>
> pointer
> 	: ^(POINTER)
> 	;
>
> ?  The following appears to be the correct way to do this, and does  
> in fact
> appear to work:
>
> pointer
> 	: POINTER
> 	;
>
> But it's not clear to me why this should be so.  Shouldn't both  
> these cases
> share the same syntax, either both ^(POINTER) or both POINTER?
>
> Thanks,
>
> -- 
> Gary R. Van Sickle
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list