[antlr-interest] Tree Grammar Syntax?

Terence Parr parrt at cs.usfca.edu
Thu Aug 7 11:11:05 PDT 2008


yes, but must use subrule at moment not tree ( ^(...) )?
Ter
On Aug 6, 2008, at 1:50 AM, Foust wrote:

> The DAR is pretty sparse about the details of using a tree grammar  
> for more than anything but the simplest cases of printing some nodes.
>
> (1)    Can subtrees be matched optionally? (Like the T_MODIFIERS  
> subtree below)
>
> stmt       : ^(T_REFERENCE  IDENTIFIER param? ^(T_MODIFIERS  
> modifiers)? n+=IDENTIFIER*) ;
>
> or is this explicitly forbidden, requiring the subtree expression to  
> be broken out into a separate rule?
>
> (2)    How are the * and + expressions accessed? Is the += operator  
> used to turn them into an ArrayList, just like in the parser?
>
> Brent
>



More information about the antlr-interest mailing list