From: | kamal <kamalpr@hp.com> |
Newsgroups: | comp.compilers |
Date: | Fri, 27 Jun 2008 04:30:57 -0700 (PDT) |
Organization: | Compilers Central |
References: | 08-06-053 08-06-055 08-06-061 |
Keywords: | parse |
Posted-Date: | 27 Jun 2008 21:31:40 EDT |
On Jun 25, 7:28 am, m...@gustavus.edu wrote:
> On Jun 24, 2:49 am, kamal <kama...@hp.com> wrote:
>
> > ...
> > Recursive (descent) parsing is leftmost. You have the follow set in
> > non-recursive parsing to figure out what *can* follow, and so opt to
> > reduce by a different rule than the leftmost reduction. It helps in
> > overcoming ambiguities that RDP have.
>
> (1) Yes, recursive descent parsing is leftmost, but that word
> "leftmost" means that the leftmost nonterminal is expanded out at each
> step, rather than anything about a "leftmost reduction" or, as your
> phrase "reduce by a different rule" suggests you might have meant,
> leftmost production. There is no reduction done at all in a recursive
yes -I meant reduce by a different production.
> descent parser, and the choice of productions is not influenced by
> their order.
>
>
> (2) The non-recursive parsing that was being discussed in the original
> post was non-recursive *predictive* parsing, i.e., LL(1) top-down
> parsing. As such, it has no reductions either and follows the same
> sequence of parsing actions. It too is constructing a leftmost
> derivation.
>
yes -I mis-interpreted it to mean RDP vs L[A]LR(1). I think the answer
has been given by others to mean, you can do error recovery with table
generated parsers.
Will RDP shift in case of shift/reduce conflict the way yacc does?
> (3) Recursive descent parsers do not have ambiguities, because
> ambiguity is a property of a grammar or a language, not a parser.
So, whats the advantage of opting for a rightmost derivation? I think
it helps when you have left-recrusive rules like
E->ET
where E and T are non-terminals.
thanks
-kamal
Return to the
comp.compilers page.
Search the
comp.compilers archives again.