[antlr-interest] V2 -> V3 rules

Jim Idle jimi at temporal-wave.com
Mon Mar 7 07:25:22 PST 2011


rhs : rhs_alt ( OR^ rhs_alt )*;



> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of g4 at novadsp.com
> Sent: Monday, March 07, 2011 6:33 AM
> To: ANTLR Interest
> Subject: [antlr-interest] V2 -> V3 rules
>
> I've checked the Migration Wiki and it's a little unclear on how handle
> the following. The general form is taken from bison.g:
>
> V2:
>
> rhs : rhs_alt
>      { ## = #( [ALT, "alt"], #rhs ); }
>      ( OR^ rhs_alt )*;
>
> V3:
>
> rhs : (a=rhs_alt -> $rhs ) (OR b=rhs)*
>      ;
>
> error(132) reference $rhs is ambiguous; rule rhs is enclosing rule and
> referenced in the production (assuming enclosing rule)
>
> V3 - not even sure if this form is legal ...
>
> rhs : rhs_alt
>          { $$ = $([OR,"or"],$rhs); }
>        (OR^ rhs_alt)*
>      ;
>
> error(117): missing attribute access on rule scope: rhs
>
> Thx++
>
> Jerry.
>
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address


More information about the antlr-interest mailing list