Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2900

Re: Some questions about recursive descent?

From gah4 <gah4@u.washington.edu>
Newsgroups comp.compilers
Subject Re: Some questions about recursive descent?
Date 2022-02-27 17:13 -0800
Organization Compilers Central
Message-ID <22-02-022@comp.compilers> (permalink)
References <22-02-021@comp.compilers>

Show all headers | View raw


On Sunday, February 27, 2022 at 1:37:09 PM UTC-8, Johann 'Myrkraverk' Oskarsson wrote:
> I am currently reading two compiler books, [Holub] and [Appel], and
> then [Salomon] for a bit of context below,
>
> [Holub] Compiler Design in C, 1990, by Allen Holub

> [Appel] Modern Compiler Implementation in ML, 2004, by Andrew Appel
>
> [Salomon] Assemblers and Loaders, 1993, David Salomon

> and I have some questions about the construction of recursive descent
> parsers. If some of my questions are adequately answered in some other
> publication, reference, preferably with chapter and verse, is welcome.

A few thoughts, which might not answer all your questions.

One is that compilers that use recursive descent often don't use it for
everything.  Some might use it only for the statement level, and
something else, such as operator precedence, for expressions.

One of the complications with recursive descent is error handling.
Consider that a user might forget, or misspell, a closing statement
of some block structure.  All the rest of the program is then parsed
as inside the block, or at least until something that isn't allowed inside.

And that might partly get to your question about returning the parse tree.
Without errors, that might be fine.  But when errors occur, the compiler
has to undo much that was done, but should not have been done. That
is somewhat easier with a global tree, than one that is distributed
throughout the recursive contexts of the called routines.

Also, much of earlier compiler design was done when computer
memories were small. Designing compilers for small memory
usage is now a lost art.

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Some questions about recursive descent? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.com> - 2022-02-27 19:02 +0000
  Re: Some questions about recursive descent? gah4 <gah4@u.washington.edu> - 2022-02-27 17:13 -0800
  Re: Some questions about recursive descent? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-02-28 06:48 +0100
  Re: Some questions about recursive descent? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2022-02-28 07:43 +0000
    Re: Some questions about recursive descent? Alain Ketterlin <alain@universite-de-strasbourg.fr.invalid> - 2022-02-28 21:52 +0100
      Re: Some questions about recursive descent? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2022-03-01 01:40 +0000
        Re: Some questions about recursive descent? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2022-03-01 08:01 +0000
        Re: Some questions about recursive descent? Alain Ketterlin <alain@universite-de-strasbourg.fr> - 2022-03-01 23:13 +0100
        Re: Some questions about recursive descent? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-03-02 05:52 +0100
    Re:Some questions about recursive descent? "Paul Robinson" <xdpascal@xdpascal.com> - 2022-03-05 14:46 -0600
  RE: Some questions about recursive descent Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2022-02-28 15:40 +0200

csiph-web