Held Monday, November 4, 2002
Today we consider the symbol tables that are core to code generation.
- Background: Associating attributes with symbols
- Sample attributes
- The implementation of symbol tables
- Translation is typically done top-down: You translate the subtrees
and then tie them together depending on the overall structure of the
- At this stage of our translation, we're somewhat free about using
temporary "variables" for partial results. In a pass over the generated
code, we'll eliminate duplicates and unused memory.
- When we translate an expression, we don't just generate code; we also
identify a memory location (most typically, a temporary location) in which
the result of that expression resides.
- We should also know the type of the result.
- We may want to keep track of what kind of memory we're talking about
at every stage:
- "temporary" (created by compiler)
- program variable (local or global)
- procedure parameter
- fixed memory location
- An offset from ...
- At many of the stages of translation, you'll need to keep track of
attributes of the symbols that appear in the program.
- Their type (for most symbols)
- Their memory location (for variables)
- The size of their stack frames (for functions and procedures)
- Their values (for constants)
- The structure used to keep track of this information is called a
- You need to think about the design of your symbol tables.
Thursday, 29 August 2002
- First version, based somewhat on outlines from