I have a couple of rewrite rules on ASTs of the following kind, for use 
as part of bottomup:

flattenOuter    @init{boolean nestd=false;}
   : ^(c=OUTER  ( ^(OUTER ds+=.*)       {nestd=true;}
                | ds+=.
                )+)
        {nestd}?
        -> ^(OUTER $ds+)
   ;

The effect is to flatten nested occurrences of the OUTER constructor.

The inner two rules are obviously conflicting but, as the top rule is 
given preference, all is well. To suppress the resulting conflict 
warnings, I used to write these type of rules with a gated semantic 
predicate:

flattenOuter    @init{boolean nestd=false;}
   : ^(c=OUTER  ( {true}?=>     ^(OUTER ds+=.*) {nestd=true;}
                | ds+=.
                )+)
        {nestd}?
        -> ^(OUTER $ds+)
   ;

ANTLR 3.2 is happy with this. ANTLR 3.4 is not: the gated rules are 
seemingly not invoked.

This doesn't quite make sense. Might this be a bug, or could someone 
enlighten me about the rationale for the seemingly changed behaviour of 
ANTLR 3.4?

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to