public class SymbolTable extends Object
Modifier and Type | Field and Description |
---|---|
protected Map |
symbols
The table of declared identifier (symbols).
|
Constructor and Description |
---|
SymbolTable() |
Modifier and Type | Method and Description |
---|---|
Object |
declare(String ident,
Object decl)
This method adds the specified identifier to this SymbolTable.
|
Object |
getDeclaration(String ident)
Checks the symbol table for the actual declaration of the specified
identifier.
|
boolean |
isDeclared(String ident)
Checks whether the specified identifier is declared.
|
protected Map symbols
public Object declare(String ident, Object decl)
null
is returned.ident
- identifier to be declareddecl
- new definition of identifiernull
otherwisepublic boolean isDeclared(String ident)
ident
- the name of identifier to be testedtrue
if the identifier is declared;
false
otherwise.public Object getDeclaration(String ident)
null
for an undeclared identifier.ident
- the name of identifiernull
otherise.Copyright © 2018. All rights reserved.