[antlr-interest] More Infinite Recursion
Jason
jasonriz at yahoo.com
Fri Jan 30 11:36:08 PST 2004
> your original, left-recursive, rule will accept this
> string;
> while your translation will not.
>
> try this:
>
> 1) rearrange terms
>
> memory:
> ( A B | E F G | H I J | M N O )
> | memory C D
> | memory K
> | memory L
> ;
>
> 2) left factor second thru last alternatives
>
> memory:
> ( A B | E F G | H I J | M N O )
> | memory ( C D | K | L )
> ;
>
> and now I hope you can see that the rule I suggest
> works better...
>
> Hope this helps
>
> -jbb
jbb,
Thanks, your answer was very informative. The first
time I compared your sample input to my rule it seemed
it should work then I realized that was because I was
expecting left recursion after the 'K' was consumed.
Doh! In any case with the slight change Chris
suggests in his follow-up you're right on the money.
Thanks again.
-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/
More information about the antlr-interest
mailing list