[antlr-interest] grammar and rewrite rule problem (newbie)

Gavin Lambert antlr at mirality.co.nz
Thu Jul 19 13:09:13 PDT 2007


At 05:40 20/07/2007, ali azimi wrote:
>How can rules like the following ( r ) be dealt with without 
>producing an infinite loop? Can you also tell me what the rewrite 
>rule for it should look like?
>
>Grammar T;
>
>r:  a  ( c | d )*  ( e | f )? g
>;
>
>a:
>;
>
>c:
>;
>e:
>;
>f:
>;
>g:
>;

Don't write empty rules -- trying to match multiple instances of 
nothing at all is an instant infinite loop. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070720/a693dbdd/attachment.html 


More information about the antlr-interest mailing list