Newsgroups: | comp.compilers |
From: | wgsteven@undergrad.math.uwaterloo.ca (Warren Stevens) |
Keywords: | errors, parse, tools |
Organization: | University of Waterloo, Pure Math and C&O Club |
References: | 94-09-142 94-09-180 |
Date: | Thu, 29 Sep 1994 16:42:29 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...
Well, my compiler prof went to great lengths to tell us this was hogwash.
His argument: once a LL parser has choosen a path, it's doomed to go along
that path, regardless of what it may find along the way. It would be
possible to back up a few steps, but that's not easy.
On the other hand, in LR parsing, the parser has a choice of a number of
rules that it can reduce, and so can make a better guess as to the type of
error the programmer has written and the best strategy to fix it. Errors
such as a missing 'if' in a if-then-else clause in Pascal are hard to fix
with a LL parser, because you get so far along in the parsing before you
realise what's happened, while in a LR parser, it's not nearly as hard,
because you can pick the rule you think the programmer meant and use it
instead of another, incorrect, rule.
Warren
--
Warren Stevens <wgstevens@undergrad.math.uwaterloo.ca>
PGP public key availible via finger. Use it.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.