[antlr-interest] Preserving subrule order

Gavin Lambert antlr at mirality.co.nz
Sun Nov 4 11:41:48 PST 2007


At 08:16 5/11/2007, Johannes Luber wrote:
 >I'm quite sure that I've seen the solution somewhere but I can't 

 >seem to find it. The problem is quite simple:
 >
 >A : (B|C)*;
 >
 >I want to rewrite that rule with the order of Bs and Cs 
preserved.
 >How do I do it?

Haven't tested this, but IIRC it goes something like:

A : (x+=(B|C))* -> ^(FOO $x*);



More information about the antlr-interest mailing list