Package net.aifusion.asn
Class SymbolTable
java.lang.Object
net.aifusion.asn.SymbolTable
Class to manage a symbol table
- Author:
- Sharad Singhal
-
Constructor Summary
ConstructorDescriptionSymbolTable
(Tokenizer tokenizer) Create a symbol table using the tokens in the tokenizer -
Method Summary
Modifier and TypeMethodDescriptionGet the symbol associated with a given symbolgetDefinition
(String name) Get the definition of a symbolgetProduction
(String name) Get the production associated with a given symbolGet the underlying map containing <symbolName,Symbol> from this symbol tableGet the primitive type associated with a symbolstatic void
void
setDefinition
(String name, AsnNode definition) Set the definition of a symbol
-
Constructor Details
-
SymbolTable
Create a symbol table using the tokens in the tokenizer- Parameters:
tokenizer
- - tokenizer containing the input definition
-
-
Method Details
-
getSymbolTable
Get the underlying map containing <symbolName,Symbol> from this symbol table- Returns:
- map containing <symbolName,Symbol>
-
getDefinition
Get the definition of a symbol- Parameters:
name
- - fully qualified name of the symbol- Returns:
- - definition of the symbol, if any. Null if the symbol is not defined, or does not yet have a definition
-
setDefinition
Set the definition of a symbol- Parameters:
name
- - fully qualified name of the symboldefinition
- - corresponding definition
-
get
Get the symbol associated with a given symbol- Parameters:
name
- - fully qualified name of the symbol- Returns:
- - associated symbol. Null if none defined
-
getProduction
Get the production associated with a given symbol- Parameters:
name
- - fully qualified name of the symbol- Returns:
- - production associated with the symbol, null if none defined
-
getType
Get the primitive type associated with a symbol- Parameters:
name
- - fully qualified name of the symbol- Returns:
- - primitive (universal) type of the symbol. Null if the symbol is not defined, or does not reduce to a universal type
-
main
-