Package symbols

Class Symbol


  • public final class Symbol
    extends java.lang.Object
    The 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.
    • Method Summary

      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 symbol
        value - The value of the symbol
        type - 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 symbol
        type - The data type of the symbol