Package symbols
Class Symbol
- java.lang.Object
-
- symbols.Symbol
-
public final class Symbol extends java.lang.ObjectThe Symbol class is used to store information about variables declared during compilation.The name, value, and data type of a variable is stored in a Symbol object, which is then stored in an instance of SymbolTable.
- Since:
- 1.0
-
-
Constructor Summary
Constructors Constructor Description Symbol(java.lang.String name, java.lang.Object value, ObjectType type)Constructs a Symbol object initialised with its name, value, and data type.Symbol(java.lang.String name, ObjectType type)Constructs a Symbol object initialised with its name and data type.
-
-
-
Constructor Detail
-
Symbol
public Symbol(java.lang.String name, java.lang.Object value, ObjectType type)Constructs a Symbol object initialised with its name, value, and data type.- Parameters:
name- The name of the symbolvalue- The value of the symboltype- The data type of the symbol
-
Symbol
public Symbol(java.lang.String name, ObjectType type)Constructs a Symbol object initialised with its name and data type.The value field automatically defaults to an empty value based on the data type parameter: - INTEGER_OBJECT is 0 - DOUBLE_OBJECT is 0.0 - BOOLEAN_OBJECT is false - STRING_OBJECT is an empty String
- Parameters:
name- The name of the symboltype- The data type of the symbol
-
-