[antlr-interest] Wildcard in tree grammar? - was validating semantic predicates

John B. Brodie jbb at acm.org
Fri Nov 30 14:34:12 PST 2007


I believe that you have to test the boolean condition on both sides of
the alternate.

Not sure whether or not that was Dr. Parr's intention.

But it seems to work for me.

>statement
>    : simpleStatement
>    |  
>      ^('if' x=condition ( { x }? statement
>                         |           .
>                         )
>       )
>   ;
   
instead try:

statement
    : simpleStatement
    |  
      ^('if' x=condition ( { x }? statement
                         | {!x }? .
                         )
       )
   ;
   



   -jbb


More information about the antlr-interest mailing list