org.inxar.syntacs.grammar.context_free
Interface Production

All Known Implementing Classes:
CFProduction

public interface Production

The Production interface is an abstraction of a discrete 'rule' in a grammar. A Production specifies a valid sequence of GrammarSymbols that may be reduce to a certain NonTerminal.


Method Summary
 Production add(GrammarSymbol grammarSymbol)
          Concatenates the given GrammarSymbol to the end of this Production sequence.
 IntArray getGrammarSymbols()
          Returns an IntArray for the right hand side of this Production.
 int getID()
          Gets the globally allocated identifier for this Production.
 Item getInitialItem()
          Returns the first Item in the Production, A := *ab.
 NonTerminal getNonTerminal()
          Returns the NonTerminal defined as the left hand side of this Production.
 int length()
          Returns the number of GrammarSymbols on the right hand side.
 

Method Detail

getID

public int getID()
Gets the globally allocated identifier for this Production.

getNonTerminal

public NonTerminal getNonTerminal()
Returns the NonTerminal defined as the left hand side of this Production.

getInitialItem

public Item getInitialItem()
Returns the first Item in the Production, A := *ab.

add

public Production add(GrammarSymbol grammarSymbol)
Concatenates the given GrammarSymbol to the end of this Production sequence. The Production object is returned simply to support a convenient java.lang.StringBuffer style of coding.

getGrammarSymbols

public IntArray getGrammarSymbols()
Returns an IntArray for the right hand side of this Production. Each member in the array is the ID of a GrammarSymbol.

length

public int length()
Returns the number of GrammarSymbols on the right hand side. This has the same effect as getGrammarSymbols().length().