Class ProductionRule
java.lang.Object
com.knezevic.edaf.v3.repr.grammar.model.ProductionRule
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 Summary
ConstructorsConstructorDescriptionProductionRule(String id, NonTerminal left, List<GrammarSymbol> right) Creates immutable production rule. -
Method Summary
Modifier and TypeMethodDescriptionReturns child symbols used to build derivation tree children.booleaninthashCode()id()Rule identifier.booleanReturns true when rule can terminate without expanding additional non-terminals.left()Left non-terminal.intReturns the number of non-terminal child symbols.operator()Returns operator terminal when RHS begins with an operator.right()Full right-hand side symbol sequence.toString()
-
Constructor Details
-
ProductionRule
Creates immutable production rule.
-
-
Method Details
-
id
Rule identifier. -
left
Left non-terminal. -
right
Full right-hand side symbol sequence. -
operator
Returns operator terminal when RHS begins with an operator. -
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
-
hashCode
-
equals
-