Re: Dragon Book question

Tom Payne <>
23 Mar 2000 22:40:57 -0500

          From comp.compilers

Related articles
Compiler project needed (Per Olesen) (2000-02-22)
Dragon Book question (Nicolás) (2000-03-23)
Re: Dragon Book question (2000-03-23)
Re: Dragon Book question (Tom Payne) (2000-03-23)
Re: Dragon Book question (2000-04-01)
| List of all articles for this month |

From: Tom Payne <>
Newsgroups: comp.compilers
Date: 23 Mar 2000 22:40:57 -0500
Organization: University of California, Riverside
References: 00-02-112 00-03-095
Keywords: books

"Nicolas" <> wrote:

> In various examples in the Dragon Book, different techniques (like
> semantica analysis, intermediate code generation, etc) are demostrated
> using syntax-directed diagrams (ie after this rule is reduced, the
> following action should be executed).

> Can I assume that the actions can be "executed" in a postorder traversal
> of the parse tree, instead that when I am actually parsing the source
> files ?

Yes, but ...

Building the parse tree and then doing a top-down traversal of the
tree seems to allow the best of both bottom-up and top-down
techniques. Some languages and grammars seem to need some help from
the symbol table in order to handle parsing. For instance, in Pascal,
it is difficult to tell the difference between a variable and a 0-ary
function. To accomodate such problems, it is often necessary to
translate the subtrees for declarations while still building the
syntax tree for the overall program.

Tom Payne

Post a followup to this message

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