[antlr-interest] Tree grammar for expression subrules?

g4 at novadsp.com g4 at novadsp.com
Sun Mar 6 04:33:21 PST 2011


Jim, thanks. To generalize then - tree grammars should 'track' the 
terminal/non-terminal structure (of interest) but exclude any 
cardinality specifiers.

On 05/03/2011 18:34, Jim Idle wrote:
> You write expressions like that in the following way:
>
> expression
>   : ^(OR expression expression)
>   | term
>   ;
>
> term
>   : X
>   | Y
>   | Z
>   ;
>
> Then do not create the UPSILON as it will just mislead you. if you feel
> you need it then add it to term, which although allowing ^(OR EPSILION
> EPSILON) won't happen because you won't produce that tree. However, don't
> generally make a token for something that isn't there.




More information about the antlr-interest mailing list