[antlr-interest] grammar and rewrite rule problem (newbie)
ali azimi
aliaazimi at yahoo.com
Thu Jul 19 15:09:23 PDT 2007
Hi,
Thank you very much for replying to my post. For simplicity I have left them empty as the rule is quite large and I thought not to bother you guys. I thought the problem was the * sign in the rule but it was not.
I have sorted out the looping problem. However a problem still remains and that is how to write the rewrite rule. Could you please suggest me a rewrite rule for the following?
r: a ( c | d )* ( e | f )? g
;
Many thanks in advance.
Best wishes,
Al
Gavin Lambert <antlr at mirality.co.nz> wrote: 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.
---------------------------------
Boardwalk for $500? In 2007? Ha!
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070719/3b7bf1d1/attachment.html
More information about the antlr-interest
mailing list