public class SymbolTable extends Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
actualScope
The actual scope level.
|
protected Stack |
nestings
Stack of old definitions.
|
protected Hashtable |
symbols
The table of declared identifier (symbols).
|
| Constructor and Description |
|---|
SymbolTable() |
| Modifier and Type | Method and Description |
|---|---|
Definition |
declare(String ident,
Definition def)
Add identifier to the actual scope.
|
void |
enterScope()
Opens a new scope.
|
protected void |
forgetNesting(Nesting nesting)
Internal method to reinstall the old definitions.
|
int |
getActualScope()
Returns the level of the actual scope.
|
Definition |
getDefinition(String ident)
Checks the symbol table for the actual definition
of the specified identifier.
|
boolean |
isDeclared(String ident)
Checks whether the specified identifier is declared.
|
void |
leaveScope()
Closes the actual scope.
|
protected int actualScope
protected Stack nestings
protected Hashtable symbols
public void enterScope()
public void leaveScope()
public int getActualScope()
public Definition declare(String ident, Definition def)
ident - identifier to be declareddef - new definition of identifierpublic boolean isDeclared(String ident)
ident - the name of identifier to be testedpublic Definition getDefinition(String ident)
ident - the name of identifierprotected void forgetNesting(Nesting nesting)
nesting - list of hidden definitionsCopyright © 2017. All rights reserved.