Class symbol

java.lang.Object
java_cup.runtime.symbol
Direct Known Subclasses:
token

public class symbol extends Object
This class represents a (terminal or non-terminal) symbol that, among other things can be placed on the parse stack. Symbols are used to keep track of state on the parse stack. The symbol currently on top of the stack contains the current state in the parse_state field. In addition to the parse_state field, symbols also maintain a record of the symbol number that they represent in the sym field. Finally, symbols are used contain to any attributes used by semantic action (this is done via fields added in subclasses -- see for example, int_token and str_token).
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    The parse state to be recorded on the parse stack with this symbol.
    int
    The symbol number of the terminal or non terminal being represented
  • Constructor Summary

    Constructors
    Constructor
    Description
    symbol(int sym_num)
    Constructor without a known state.
    symbol(int sym_num, int state)
    Full constructor.
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • sym

      public int sym
      The symbol number of the terminal or non terminal being represented
    • parse_state

      public int parse_state
      The parse state to be recorded on the parse stack with this symbol. This field is for the convenience of the parser and shouldn't be modified except by the parser.
  • Constructor Details

    • symbol

      public symbol(int sym_num, int state)
      Full constructor.
    • symbol

      public symbol(int sym_num)
      Constructor without a known state.