Re: Recursive-descent parser generator wanted

Michael Scott <harvard!rutgers!cs.rochester.edu!scott@BBN.COM>

          From comp.compilers

Related articles
Recursive-descent parser generator wanted abakus%uklirb@unido.uucp (AG Hartenstein-UNI KL-FRG) (1988-02-11)
Re: Recursive-descent parser generator wanted blia.UUCP!irving@cgl.ucsf.edu (1988-02-25)
Re: Recursive-descent parser generator wanted harvard!rutgers!cs.rochester.edu!scott@BBN.COM (Michael Scott) (1988-03-15)
| List of all articles for this month |
Newsgroups: comp.compilers
References: <887@ima.ISC.COM>
From: Michael Scott <harvard!rutgers!cs.rochester.edu!scott@BBN.COM>
Organization: U of Rochester, CS Dept, Rochester, NY

| [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
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.