Newsgroups: | comp.compilers |
From: | jon@mauney.com (Jon Mauney) |
Keywords: | errors, parse, tools |
Organization: | Interpath -- Providing Internet access to North Carolina |
References: | 94-09-142 94-09-180 |
Date: | Thu, 29 Sep 1994 18:24:47 GMT |
johnm@po.EECS.Berkeley.EDU (John D. Mitchell) writes:
>... It is generally the
>case that LR generators are much harder to get good error recovery out of.
>LL generators tend to make this a good bit easier...
rfg@netcom.com (Ronald F. Guilmette) writes:
>This seems to be the current `conventional wisdom' (among a lot of folks I
>know anyway), but is it really true?
>... These
>days however, everyone seems to be saying that recursive descent is better
>for error recovery, and that's rather disconcerting to me.
A) LL parsers have a very simple method of operation, which makes it
easy to extract the information needed for high-quality error
recovery. LL parsers predict what symbols are upcoming in
the left context, and push the prediction onto a stack,
from which it is quite easy to extract.
LR parsers have parsing information cleverly encoded
in CFSM states; error recovery needs to cleverly extract that
information again. So an error recovery algorithm for an LR parser
needs more code or more auxiliary tables than an equivalent algorithm
for an LL parser.
2) LL(1) is not equivalent to recursive descent. LL parsers can
(and should) be table-driven. Recursive descent takes the very
simple predictions of upcoming context, and encodes it into
the procedure call stack, which again requires code and/or
auxiliary data to extract.
--
Jon Mauney jon@mauney.com
Mauney Computer Consulting (919) 828-8053
Raleigh NC
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.