Class AssemblySymbol

  • All Implemented Interfaces:
    java.lang.Comparable<AssemblySymbol>
    Direct Known Subclasses:
    AssemblyNonTerminal, AssemblyTerminal

    public abstract class AssemblySymbol
    extends java.lang.Object
    implements java.lang.Comparable<AssemblySymbol>
    A symbol in a context-free grammar Symbols can be either terminals or non-terminals. Non-terminals must have a defining production, i.e., it must appear as the left-hand side of some production in the grammar. Traditionally, when displayed, non-terminals should be immediately distinguishable from terminals. In classic CS literature, this usually means non-terminals are in CAPS, and terminals are in lower-case. Because the assembler doesn't control the names provided by SLEIGH, we surround non-terminals in [brackets].
    See Also:
    AbstractAssemblyGrammar
    • Field Summary

      Fields 
      ChangeModifier and Type Field Description
      NEWprotected java.lang.String name  
    • Constructor Summary

      Constructors 
      ChangeConstructor Description
      AssemblySymbol​(java.lang.String name)
      Construct a new symbol with the given name
    • Field Detail

      • name NEW

        protected final java.lang.String name

Constructor Detail

  • Method Detail

    • toString

      public abstract java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • getName

      public java.lang.String getName()
      Get the name of this symbol
      Returns:
      the name
    • equals

      public boolean equals​(java.lang.Object that)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • takesOperandIndex

      public boolean takesOperandIndex()
      Check if this symbol consumes an operand index of its constructor
      Returns:
      true if the symbol represents an operand