Chapter 7: Intermediate representation and symbol table

Representing Scope Information

. entries are declarations of names

. when a lookup is done, entry for appropriate declaration must be returned

. scope rules determine which entry is appropriate

. maintain separate table for each scope

. symbol table for a procedure or scope is compile time equivalent an activation record

. information about non local is found by scanning symbol table for the enclosing procedures

. symbol table can be attached to abstract syntax of the procedure (integrated into intermediate representation)

The entries in the symbol table are for declaration of names. When an occurrence of a name in the source text is looked up in the symbol table, the entry for the appropriate declaration, according to the scoping rules of the language, must be returned. A simple approach is to maintain a separate symbol table for each scope.