Path: utzoo!mnetor!uunet!husc6!necntc!ima!johnl From: harvard!rutgers!cs.rochester.edu!scott@BBN.COM (Michael Scott) Newsgroups: comp.compilers Subject: Re: Recursive-descent parser generator wanted Message-ID: <909@ima.ISC.COM> Date: 18 Mar 88 13:35:22 GMT References: <887@ima.ISC.COM> Sender: johnl@ima.ISC.COM Reply-To: Michael Scott Organization: U of Rochester, CS Dept, Rochester, NY Lines: 36 Approved: compilers@ima.UUCP | [At the risk of much flamage, I'd be interested in comments about why one | might prefer an R.D. parser generator to an LR one. We've beaten error | recovery to death, unless someone has something genuinely new. -John] Let's tackle the easy question first: why might one prefer an LL parser to an LR one. Answer: (1) because the table sizes are a lot smaller (2) because many people find the parsing technique a lot more intuitive (3) because it lets you put action routines anywhere you want to in your grammar (4) because it is amenable to very simple, high-quality, automatic syntactic error recovery (ala Fischer, Milton, and Quiring) Now the harder question: why might one prefer recursive descent [John's note was in response to a request for tools to build recursive descent parsers automatically]. Possible answers: (1) because you can look at the parser and really *see* what it's doing (2) because you can modify it even if you don't have the parser generator available (this might actually be a concern if you want to distribute the parser with source, but without the tools) (3) because it might conceivably run a little faster, just as "compiled" scanner tables (implemented with gotos) run faster than table-driven lex Of course, the recursive descent parser will be larger than the table-driven LL parser, and it won't support FMQ error recovery. -- Michael L. Scott University of Rochester (716) 275-7745 scott@cs.rochester.edu scott%rochester@CSNET-RELAY {decvax, allegra, cmcl2}!rochester!scott -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU Plausible paths are { ihnp4 | decvax | cbosgd | harvard | yale | bbn}!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