 
 
 
 
 
   
 Next: Backpatching
Up: Compiler Theory: Intermediate Code Generation
 Previous: Optimizations for the generated code
 
         
LOOKING UP SYMBOLS.  One should avoid intensive searching for symbols in the symbol table
during type checking and translation.
- The syntax-directed definitions shown earlier 
        for simple code generation use names as the attributes 
 .place. .place.
- In fact, names should be represented by pointers to symbol-table entries
      (rather than strings).
- These pointers can be set up during the lexical analysis.
- Hence the value associated with a token TOK_ID (for identifiers)
      returned by LEX should better be a pointer to an entry of the symbol table
      rather than a string.
EMISSION RATHER THAN CONCATENATION.  Instead of attaching a string S.string to each instance of the grammar symbol
S encountered during the translation,
one should try 
- either to write 3-address statements directly into output.
- or to append linked lists of strings (where previously we were concatenating strings).
In the next syntax-directed definitions, the procedure emit writes
3-address statements directly into output.
 
Subsections
 
 
 
 
 
   
 Next: Backpatching
Up: Compiler Theory: Intermediate Code Generation
 Previous: Optimizations for the generated code
Marc Moreno Maza 
2004-12-02