[antlr-interest] Tree grammar conditionally run subrule

Terence Parr parrt at cs.usfca.edu
Thu May 29 12:50:35 PDT 2008


$a.r
Ter
On May 29, 2008, at 11:45 AM, Fridi wrote:

> 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