Go to the previous, next section.

Procedure Symbol Tables

Procedure symbol tables represent the top-level scopes within procedures and are associated with the tree_proc objects at the roots of the abstract syntax trees for the procedures. See section Procedure Nodes. Because the procedure symbol tables provide a superset of the block symbol table functions, they are implemented by deriving the proc_symtab class from the block_symtab class. Thus, all of the block_symtab methods can also be applied to proc_symtab objects.

Besides the inherited methods, the procedure symbol tables have some added features. Each procedure symbol table contains a list of the formal parameters for the procedure. The params method returns a pointer to this list. The entries on this list must be pointers to symbols for variables that are contained within the procedure symbol table. (Formal parameters cannot be global variables or local variables in inner scopes.) The symbols are listed in order. If the function type for the procedure specifies the parameter types, they should match the types of the variables on the parameter list.

The procedure symbol table also records the next instruction ID number for the procedure (see section ID Numbers for Tree Nodes and Instructions). The number_locals method handles the task of assigning ID numbers to the symbols and types in symbol tables within the procedure (see section Numbering Types and Symbols).

Go to the previous, next section.