org.metasyntactic.math.automata
Class AugmentedGrammar

java.lang.Object
  |
  +--org.metasyntactic.math.automata.ContextFreeGrammar
        |
        +--org.metasyntactic.math.automata.AugmentedGrammar
All Implemented Interfaces:
FiniteAutomata, java.io.Serializable

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
ContextFreeGrammar.CFGSymbol
 
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

AugmentedGrammar

public AugmentedGrammar(ContextFreeGrammar augmented,
                        ContextFreeGrammar original)
Method Detail

getBaseGrammar

public ContextFreeGrammar getBaseGrammar()

toString

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