[antlr-interest] Tree grammar conditionally run subrule

Fridi fridi70 at gmx.de
Thu May 29 11:45:16 PDT 2008


Thanks, yes, expression returns bool.
I tried that, but ANTLRWorks (1.1.7) cannot generate C#/Java out of this 
:'(

"missing attribute access on rule scope: a"

expression[IBObject record] returns [bool r = false]
    // evaluate 2 expression with OR
    : ^(OR a = expression[record]
        ( { $a }? => . { $r = true; }
          | b = expression[record] { $r = $b; }
             )
       )


Did I miss something?



Gavin Lambert schrieb:
>
> How about this:
>
> ^(OR a=expression
> ( { $a }? => . { $r = true; }
> | b=expression { $r = $b; }
> )
> )
>
> (I'm assuming that expression already returns a boolean.)
>



More information about the antlr-interest mailing list