[antlr-interest] Preserving subrule order

Johannes Luber jaluber at gmx.de
Sun Nov 4 11:43:03 PST 2007


Gavin Lambert wrote:
> 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*);
> 
Thanks!

Johannes


More information about the antlr-interest mailing list