[antlr-interest] Infinite Recursion
Jason
jasonriz at yahoo.com
Tue Jan 27 12:32:27 PST 2004
Monty,
Thanks for the solution and especially for the link -
the article was very, very informative.
-jason
--- mzukowski at yci.com wrote:
> Seems to me it's
> dimentia: ("BAR")* ("FOO")* ;
>
> Perhaps with an action to ensure that at least one
> matched.
>
> Monty
>
> Also see http://javadude.com/articles/lalrtoll.html
>
> Monty
>
> -----Original Message-----
> From: Jason [mailto:jasonriz at yahoo.com]
> Sent: Tuesday, January 27, 2004 10:29 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] Infinite Recursion
>
> Hello,
>
> I'm just run antlr agains a yacc grammar and it
> generated hundreds of 'infinite recursion' errors.
> I've spent quite a bit of time on the ANTLR site
> (which is excellent by the way) and I'm trying to
> wrap
> my head around all of this stuff. I understand that
> the errors are generated because ANTLR parses top
> down
> so can't handle the Left Hand Recursion which is
> common in YACC grammars. I can convert the LHR for
> the simple case which only involves one rule but am
> at
> a bit of a loss to handle the following which is a
> much simplified version of a piece of my grammar:
>
> startRule:
> dimentia;
>
> dimentia:
> gentle | "FOO";
>
> gentle:
> "BAR" | dimentia;
>
> which produces 3 infinite recursion errors. I
> understand the problem but it's not clear to me how
> to
> fix it :)
>
> On a related note - I've noticed that ANTLR doesn't
> complain about the following grammar:
>
> startRule:
> dimentia;
>
> dimentia:
> gentle;
>
> gentle:
> dimentia;
>
> Though when I look at the generated parser it seems
> as
> though it would obviously be infinitely recursive.
> Just wondering. Thanks in advance for any replies!
>
> -jason
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool.
> Try it!
> http://webhosting.yahoo.com/ps/sb/
>
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/antlr-interest/
>
> To unsubscribe from this group, send an email to:
> antlr-interest-unsubscribe at yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/antlr-interest/
>
> To unsubscribe from this group, send an email to:
> antlr-interest-unsubscribe at yahoogroups.com
>
> Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list