Re: Dragon Book question

Tom Payne <thp@roam-thp2.cs.ucr.edu>
23 Mar 2000 22:40:57 -0500

          From comp.compilers

Related articles
Compiler project needed pel@realtime.dk (Per Olesen) (2000-02-22)
Dragon Book question lojedaortiz@interlink.com.ar (Nicolás) (2000-03-23)
Re: Dragon Book question rkrayhawk@aol.com (2000-03-23)
Re: Dragon Book question thp@roam-thp2.cs.ucr.edu (Tom Payne) (2000-03-23)
Re: Dragon Book question cgbatema@undergrad.math.uwaterloo.ca (2000-04-01)
| List of all articles for this month |

From: Tom Payne <thp@roam-thp2.cs.ucr.edu>
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" <lojedaortiz@interlink.com.ar> 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.