Re: Position of an Intermediate Code Generator

"Torben Ægidius Mogensen" <torbenm@diku.dk>
21 Jul 2002 02:04:57 -0400

          From comp.compilers

Related articles
Position of an Intermediate Code Generator dirkduck2@hotmail.com (Chris Rowland) (2002-07-15)
Re: Position of an Intermediate Code Generator torbenm@diku.dk (Torben Ægidius Mogensen) (2002-07-21)
Re: Position of an Intermediate Code Generator hannah@schlund.de (Hannah Schroeter) (2002-07-21)
Re: Position of an Intermediate Code Generator marcov@toad.stack.nl (Marco van de Voort) (2002-07-31)
Re: Position of an Intermediate Code Generator pfroehli@ics.uci.edu (Peter H. Froehlich) (2002-08-04)
| List of all articles for this month |
From: "Torben Ægidius Mogensen" <torbenm@diku.dk>
Newsgroups: comp.compilers
Date: 21 Jul 2002 02:04:57 -0400
Organization: Department of Computer Science, University of Copenhagen
References: 02-07-060
Keywords: design, practice
Posted-Date: 21 Jul 2002 02:04:57 EDT

"Chris Rowland" <dirkduck2@hotmail.com> writes:


> Hello everyone. Im working on my first compiler, basing it off what
> I've learned/am learning from "Compilers: Principles Techniques and
> Tools". So far I have a fairly good grasp I'd say, and have layed a
> foundation for a lexical analizer and parser. Now im at the state
> that I'd like to add a basic intermediate code generator. The book
> seems to explain about the subject a bit, but I havn't found where to
> actually put it. For instance, would I want to generate intermediate
> (3 adress most likely) code during the parsing, after, or some other
> time? Thanks for any help.


I prefer to let the parser generate an abstract syntax tree as a data
structure and then generate intermediate code from that, possibly
using several passes (e.g., one pass to collect symbol information and
another to do the actual code generation).


The "Dragon Book", which you refer to, describe how to do code
generation during parsing. While this is possible, it makes for a
less clean structure for your compiler, and the main reason for doing
it (lack of memory for keeping the entire syntax tree in memory) is
not important these days.


Torben Mogensen (torbenm@diku.dk)


Post a followup to this message

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