3 <!-- This HTML file has been created by texi2html 1.54
4 from suif1.texi on 28 April 1999 -->
6 <TITLE>The SUIF Version
1 Library - Symbol Table Hierarchy
</TITLE>
7 <link href=
"suif1_42.html" rel=Next
>
8 <link href=
"suif1_40.html" rel=Previous
>
9 <link href=
"suif1_toc.html" rel=ToC
>
13 <p>Go to the
<A HREF=
"suif1_1.html">first
</A>,
<A HREF=
"suif1_40.html">previous
</A>,
<A HREF=
"suif1_42.html">next
</A>,
<A HREF=
"suif1_113.html">last
</A> section,
<A HREF=
"suif1_toc.html">table of contents
</A>.
17 <H2><A NAME=
"SEC41" HREF=
"suif1_toc.html#TOC41">Symbol Table Hierarchy
</A></H2>
23 The SUIF symbol tables are organized in a hierarchy of nested scopes and
24 maintained internally within a tree structure. Every table contains a
25 list of the symbol tables that are its children, and each table also has
26 a pointer back to its parent in the tree (except for the global symbol
27 table which does not have a parent). The
<CODE>children
</CODE> method returns
28 a pointer to the list of children and the
<CODE>parent
</CODE> method gets the
29 pointer to the parent symbol table. Thus, to search through all of the
30 enclosing scopes, one can follow the parent pointers back to the global
31 symbol table, visiting all of the symbol tables along the way. The
32 <CODE>is_ancestor
</CODE> method provides an easy way to check if a given
33 symbol table is an ancestor (i.e. an enclosing scope) of the current
38 Note that the symbol table hierarchy is not independent. The primary
39 objects in a SUIF program are the files and the abstract syntax trees
40 for the procedures. The symbol tables are always attached to these
41 primary objects and are generally treated as if they are parts of those
42 objects. For example, when a block of code is deleted the associated
43 symbol table is automatically removed from the hierarchy and deleted.
48 The
<CODE>base_symtab
</CODE> class is the base class from which the other
49 symbol table classes are derived, but it is an abstract class and cannot
50 be used directly. There are four different derived symbol tables
51 classes. They have much in common, but each is used at a different
52 level in the hierarchy and thus has slightly different features.
57 <LI><A HREF=
"suif1_42.html#SEC42">Global Symbol Table
</A>: Global scope (shared across files).
58 <LI><A HREF=
"suif1_43.html#SEC43">File Symbol Tables
</A>: File-level global scopes.
59 <LI><A HREF=
"suif1_44.html#SEC44">Procedure Symbol Tables
</A>: Top-level procedure scopes.
60 <LI><A HREF=
"suif1_45.html#SEC45">Block Symbol Tables
</A>: Nested scopes within procedures.
64 <p>Go to the
<A HREF=
"suif1_1.html">first
</A>,
<A HREF=
"suif1_40.html">previous
</A>,
<A HREF=
"suif1_42.html">next
</A>,
<A HREF=
"suif1_113.html">last
</A> section,
<A HREF=
"suif1_toc.html">table of contents
</A>.