|Compiler project needed email@example.com (Per Olesen) (2000-02-22)|
|Dragon Book question firstname.lastname@example.org (Nicolás) (2000-03-23)|
|Re: Dragon Book question email@example.com (2000-03-23)|
|Re: Dragon Book question firstname.lastname@example.org (Tom Payne) (2000-03-23)|
|Re: Dragon Book question email@example.com (2000-04-01)|
|From:||Tom Payne <firstname.lastname@example.org>|
|Date:||23 Mar 2000 22:40:57 -0500|
|Organization:||University of California, Riverside|
"Nicolas" <email@example.com> 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.
Return to the
Search the comp.compilers archives again.