Class AugmentedGrammar

All Implemented Interfaces:

public class AugmentedGrammar
extends ContextFreeGrammar

If G is a grammar with start symbol S, then G', the augmented grammar for G, is G with a new Start symbol S' and production S' → S. The purpose of this new starting production is to indicate to the parser when it should stop parsing and announce acceptance of the input. That is, acceptance occurs when and only when the parser is about to reduce by S' → S.

See Also:
ContextFreeGrammar, ContextFreeGrammar.augment(), Serialized Form

Nested Class Summary
Nested classes inherited from class org.metasyntactic.math.automata.ContextFreeGrammar
Field Summary
Fields inherited from class org.metasyntactic.math.automata.ContextFreeGrammar
cachedFirst, cachedFollow, inChomskyNormalForm, nullable, productions, productionVarToYield, startVariable, terminals, variables
Constructor Summary
AugmentedGrammar(ContextFreeGrammar augmented, ContextFreeGrammar original)
Method Summary
 ContextFreeGrammar getBaseGrammar()
 java.lang.String toString()
Methods inherited from class org.metasyntactic.math.automata.ContextFreeGrammar
accept, augment, computeAux, computeFirst, computeFollow, computeNullable, first, first, follow, getProductions, getStartVariable, getTerminals, getVariables, isNullable, isNullable, main
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public AugmentedGrammar(ContextFreeGrammar augmented,
                        ContextFreeGrammar original)
Method Detail


public ContextFreeGrammar getBaseGrammar()


public java.lang.String toString()
toString in class ContextFreeGrammar