Class AbstractAssemblyProduction<NT extends AssemblyNonTerminal>

java.lang.Object
ghidra.app.plugin.assembler.sleigh.grammars.AbstractAssemblyProduction<NT>
Type Parameters:
NT - the type of non-terminals
All Implemented Interfaces:
Comparable<AbstractAssemblyProduction<NT>>
Direct Known Subclasses:
AssemblyExtendedProduction, AssemblyProduction

public abstract class AbstractAssemblyProduction<NT extends AssemblyNonTerminal> extends Object implements Comparable<AbstractAssemblyProduction<NT>>
Defines a production in a context-free grammar, usually for parsing mnemonic assembly
See Also:
  • Constructor Details

    • AbstractAssemblyProduction

      public AbstractAssemblyProduction(NT lhs, AssemblySentential<NT> rhs)
      Construct a production with the given LHS and RHS
      Parameters:
      lhs - the left-hand side
      rhs - the right-hand side
  • Method Details

    • getIndex

      public int getIndex()
      Get the index of the production

      Instead of using deep comparison, the index is often used as the identity of the production within a grammar.

      Returns:
      the index
    • getLHS

      public NT getLHS()
      Get the left-hand side
      Returns:
      the LHS
    • getRHS

      public AssemblySentential<NT> getRHS()
      Get the right-hand side
      Returns:
      the RHS
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int compareTo(AbstractAssemblyProduction<NT> that)
      Specified by:
      compareTo in interface Comparable<NT extends AssemblyNonTerminal>
    • hashCode

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

      public String getName()
      Get the "name" of this production

      This is mostly just notional and for debugging. The name is taken as the name of the LHS.

      Returns:
      the name of the LHS