From: | Etienne Gagnon <egagnon@sablevm.org> |
Newsgroups: | comp.compilers |
Date: | 22 Jul 2006 21:30:23 -0400 |
Organization: | Compilers Central |
References: | 06-07-024 06-07-027 06-07-035 06-07-046 06-07-050 06-07-055 06-07-059 |
Keywords: | parse, LR(1) |
Posted-Date: | 22 Jul 2006 21:30:22 EDT |
Hans-Peter Diettrich wrote:
> Let me summarize my points (John, you may drop my long answer ;-)
>
> 1. LL parsers cannot handle left recursion, whereas LR parsers cannot
> handle right recursion.
I'm not sure I understand clearly... What do you mean by "LR parsers
cannot handle right recursion"?
There is no LALR(1) conflict in the following "right recursive" grammar
(SableCC-like syntax):
rht_rec_rule =
{one} some token |
{many} some token rht_rec_rule;
As far as I remember, LR parsers can deal with both left and right
recusrsive grammars. Maybe you meant something else?
Etienne
--
Etienne M. Gagnon, Ph.D. http://www.info2.uqam.ca/~egagnon/
SableVM: http://www.sablevm.org/
SableCC: http://www.sablecc.org/
Tokens
some = ; // dummy
tokens = ; // dummy
Productions
rht_rec_rule =
{one} some tokens |
{many} some tokens rht_rec_rule;
Return to the
comp.compilers page.
Search the
comp.compilers archives again.