Go to the first, previous, next, last section, table of contents.

Procedure Nodes

A special kind of block node is used as the root of each AST. These tree_proc nodes are derived from the tree_block class. They are essentially the same as other block nodes, but they include a few extra methods and have a slightly different kind of symbol table. SUIF does not support nested procedures, so tree_proc nodes may only be used at the roots of ASTs.

A procedure node's symbol table must be a proc_symtab instead of just an ordinary block_symtab. The proc_syms method is provided to cast the symbol table pointer to be a proc_symtab. A tree_proc node also has a pointer to the symbol of the corresponding procedure. This pointer is set automatically when a tree_proc is attached to the procedure symbol. For any tree node in an AST, the proc method retrieves this procedure symbol from the tree_proc at the root of the tree.

Because tree_proc nodes are always at the roots of the ASTs, their parent list pointers (see section Other Features Shared by All Tree Nodes) are always NULL.


Go to the first, previous, next, last section, table of contents.