Related articles |
---|
Re: Recursive-descent C parser WANTED doug@netcom.com (1992-02-27) |
Re: Recursive-descent C parser WANTED bliss@sp64.csrd.uiuc.edu (1992-02-27) |
Re: Recursive-descent C parser WANTED henry@zoo.toronto.edu (1992-02-27) |
Re: Recursive-descent C parser WANTED wjw@eb.ele.tue.nl (1992-03-04) |
Newsgroups: | comp.sources.wanted,comp.compilers |
From: | doug@netcom.com (Doug Merritt) |
Followup-To: | comp.compilers |
Keywords: | yacc, design, errors |
Organization: | Netcom - Online Communication Services (408 241-9760 guest) |
References: | <1776@wrdis01.af.mil> <1342@dms.UUCP> |
Date: | Thu, 27 Feb 92 01:40:38 GMT |
In article <1342@dms.UUCP> albaugh@dms.UUCP (Mike Albaugh) writes:
> Anyway, while such programs [Yacc/Lex/Bison/Flex] are "cool", they
>leave much to be desired in the area of error recovery, just the area
>where it is pretty simple to get a naive recursive descent parser to help
>a lot.
Adding error actions to Yacc grammars is not all that different from
adding error actions to recursive descent parsers. And in both cases
you're not likely to end up with very good error recovery until you've
hand collected many, many instances of real world errors and done
considerable work at sticking per-case reporting & recovery back into the
parser.
The added bonus to parser generators is that it is possible to add
variations on automated Graham-Rhodes error recovery to them, although in
the case of Yacc it takes an awful lot of work at reverse engineering its
tables, and some cases can't be handled due to info thrown away. (This is
what eyacc corrected for the narrow case of Berkeley Pascal.)
I haven't tried it for Bison; it would very likely be much easier there
than it is in Yacc.
You still want to optimize error reporting and recovery by hand, but it's
preferable for there to be an automatic default for the cases not handled
by hand-crafted error actions.
I suppose handling recursive descent might be considered more transparent
for the uninitiated.
Doug
--
Doug Merritt Preferred: doug@netcom.com (or: doug@eris.berkeley.edu)
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.