Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!pyrnj!mirror!ima!johnl From: johnl@ima.UUCP (Compilers mailing list) Newsgroups: mod.compilers Subject: Re: advice needed re: parsing C decl syntax Message-ID: <378@ima.UUCP> Date: Tue, 16-Dec-86 16:20:24 EST Article-I.D.: ima.378 Posted: Tue Dec 16 16:20:24 1986 Date-Received: Thu, 18-Dec-86 02:12:28 EST References: <282@ima.UUCP>, <843@basser.oz> Reply-To: ihnp4!utzoo!henry Lines: 31 Approved:> ... Doing [automatic error recovery] in a procedural recursive-descent > parser requires passing recovery sets to each parsing procedure... > This slows the parser (even when parsing a syntactically correct program), > and increases the stack space requirements... On the contrary, doing automatic error recovery in recursive descent does not require this, although one particular error-recovery algorithm may. (I would add that if you are implementing the usually-sparse recovery sets as bitmaps and passing them by value, as one might all-too-easily do in Pascal, it's not surprising that the result is slow and bulky.) Building automatic error recovery into a recursive-descent parser is not difficult or inefficient if you think hard and do it right; I speak from experience with a C parser, not exactly a favorable case. While I tend to agree that table-driven parsers are likely to be a lot smaller and possibly somewhat faster, the *practical* differences in error recovery are not significant. (Why was I doing recursive-descent parsing if I think table-driven is better, you ask? Partly because of some of the nice practical conveniences of recursive descent, partly because the particular project was supposed to be highly portable and hence I didn't want to be dependent on a big parser generator that I couldn't export freely. I tinkered with hand-generated tables for a bit, and I think that approach could have been made to work acceptably, but it was taking too long to get all the details right.) Henry Spencer @ U of Toronto Zoology {allegra,ihnp4,decvax,pyramid}!utzoo!henry -- Send compilers mail to ima!compilers or, in a pinch to Levine@YALE.EDU Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | bbncca}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request