|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object minijava.symtable.SymbolTable<T>
public class SymbolTable<T extends Binding>
A symbol table binds Symbol
objects to Binding
s. The
implementation of this symbol table represents scoping with a tree-like
structure. A SymbolTable
has a parent SymbolTable
reference
that represents its parent superscope.
Symbol
,
Binding
Constructor Summary | |
---|---|
SymbolTable()
Creates a symbol table on its own scope (i.e., no parent superscope). |
|
SymbolTable(SymbolTable<T> parent)
Creates a symbol table with the supplied argument as its parent super scope. |
Method Summary | |
---|---|
void |
bind(java.lang.String sym,
T binding)
Binds the given symbol string to the given binding. |
void |
bind(Symbol symbol,
T binding)
Binds the given symbol to the given binding. |
SymbolTable<T> |
getSuperScope()
|
T |
lookup(java.lang.String sym)
Consults this symbol table with the given symbol string. |
T |
lookup(Symbol symbol)
Consults this symbol table with the given symbol. |
java.lang.String |
toString()
Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SymbolTable()
public SymbolTable(SymbolTable<T> parent)
parent
- the parent super scope symbol tableMethod Detail |
---|
public T lookup(Symbol symbol)
null
if no such entry exists.
symbol
- the symbol
public T lookup(java.lang.String sym)
null
if no such entry exists.
sym
- the symbol string
public void bind(Symbol symbol, T binding)
symbol
- the symbolbinding
- the binding to associate with the givens symbolpublic void bind(java.lang.String sym, T binding)
sym
- the symbol stringbinding
- the binding to associate with the givens symbol stringpublic SymbolTable<T> getSuperScope()
@Deprecated public java.lang.String toString()
SymbolTable<Type>
.
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |