Class ProductionRule

java.lang.Object
com.knezevic.edaf.v3.repr.grammar.model.ProductionRule

public final class ProductionRule extends Object
One grammar production rule.

Right-hand side may begin with an OperatorTerminal followed by argument symbols, or contain a single leaf terminal/non-terminal.

  • Constructor Details

  • Method Details

    • id

      public String id()
      Rule identifier.
    • left

      public NonTerminal left()
      Left non-terminal.
    • right

      public List<GrammarSymbol> right()
      Full right-hand side symbol sequence.
    • operator

      public OperatorTerminal operator()
      Returns operator terminal when RHS begins with an operator.
    • childSymbols

      public List<GrammarSymbol> childSymbols()
      Returns child symbols used to build derivation tree children.
    • isLeafCandidate

      public boolean isLeafCandidate()
      Returns true when rule can terminate without expanding additional non-terminals.
    • nonTerminalChildCount

      public int nonTerminalChildCount()
      Returns the number of non-terminal child symbols.
    • toString

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

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

      public boolean equals(Object obj)
      Overrides:
      equals in class Object