|Position of an Intermediate Code Generator email@example.com (Chris Rowland) (2002-07-15)|
|Re: Position of an Intermediate Code Generator firstname.lastname@example.org (Torben Ćgidius Mogensen) (2002-07-21)|
|Re: Position of an Intermediate Code Generator email@example.com (Hannah Schroeter) (2002-07-21)|
|Re: Position of an Intermediate Code Generator firstname.lastname@example.org (Marco van de Voort) (2002-07-31)|
|Re: Position of an Intermediate Code Generator email@example.com (Peter H. Froehlich) (2002-08-04)|
|From:||"Torben Ęgidius Mogensen" <firstname.lastname@example.org>|
|Date:||21 Jul 2002 02:04:57 -0400|
|Organization:||Department of Computer Science, University of Copenhagen|
|Posted-Date:||21 Jul 2002 02:04:57 EDT|
"Chris Rowland" <email@example.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 (firstname.lastname@example.org)
Return to the
Search the comp.compilers archives again.