[antlr-interest] Breaking a loop

Bryan Ewbank ewbank at gmail.com
Sat Nov 5 04:45:54 PST 2005


Correct me if I'm wrong, or if the example was over-simplified, but
isn't this equivalent?

   ( ( state_end ) => state_end { break; }
   | .
   )*

No need to chew through the (io_opt)* because it will /always/ match
just before a state_end.

It's still the same fundamental problem, but it is perhaps easier to
think about...

On 11/4/05, John Green <greenj at ix.netcom.com> wrote:
> I've got a pre-existing language with a requirement like this:
>
>     (    ( (io_opt)* state_end )=> (io_opt)* state_end {break;}
>     |    .
>     )*
>


More information about the antlr-interest mailing list