Re: Some questions about recursive descent?

gah4 <gah4@u.washington.edu>
Sun, 27 Feb 2022 17:13:34 -0800 (PST)

          From comp.compilers

Related articles
Some questions about recursive descent? johann@myrkraverk.com (Johann 'Myrkraverk' Oskarsson) (2022-02-27)
Re: Some questions about recursive descent? gah4@u.washington.edu (gah4) (2022-02-27)
Re: Some questions about recursive descent? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2022-02-28)
Re: Some questions about recursive descent? anton@mips.complang.tuwien.ac.at (2022-02-28)
Re: Some questions about recursive descent? alain@universite-de-strasbourg.fr.invalid (Alain Ketterlin) (2022-02-28)
Re: Some questions about recursive descent? johann@myrkraverk.invalid (Johann 'Myrkraverk' Oskarsson) (2022-03-01)
Re: Some questions about recursive descent? anton@mips.complang.tuwien.ac.at (2022-03-01)
Re: Some questions about recursive descent? alain@universite-de-strasbourg.fr (Alain Ketterlin) (2022-03-01)
[2 later articles]
| List of all articles for this month |
From: gah4 <gah4@u.washington.edu>
Newsgroups: comp.compilers
Date: Sun, 27 Feb 2022 17:13:34 -0800 (PST)
Organization: Compilers Central
References: 22-02-021
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="55008"; mail-complaints-to="abuse@iecc.com"
Keywords: parse
Posted-Date: 27 Feb 2022 21:52:24 EST
In-Reply-To: 22-02-021

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.


Post a followup to this message

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