Class AssemblySymbol

java.lang.Object
ghidra.app.plugin.assembler.sleigh.symbol.AssemblySymbol
All Implemented Interfaces:
Comparable<AssemblySymbol>
Direct Known Subclasses:
AssemblyNonTerminal, AssemblyTerminal

public abstract class AssemblySymbol extends Object implements 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:
  • Field Details

    • name

      protected final String name
  • Constructor Details

    • AssemblySymbol

      public AssemblySymbol(String name)
      Construct a new symbol with the given name
      Parameters:
      name - the name
  • Method Details

    • toString

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

      public String getName()
      Get the name of this symbol
      Returns:
      the name
    • compareTo

      public int compareTo(AssemblySymbol that)
      Specified by:
      compareTo in interface Comparable<AssemblySymbol>
    • equals

      public boolean equals(Object that)
      Overrides:
      equals in class Object
    • hashCode

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

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