public class Grammar extends Object
Constructor and Description |
---|
Grammar(dk.brics.automaton.Automaton a) |
Grammar(dk.brics.automaton.Automaton a,
boolean lenient) |
Grammar(NonTerminal n) |
Modifier and Type | Method and Description |
---|---|
void |
apply(GrammarEntityVisitor v)
Applies the visitor to the grammar.
|
Set<Terminal> |
getEpsilon()
Gets the set Ε of all terminals from the grammar.
|
Map<NonTerminal,Collection<Production>> |
getP()
The map from all nonterminals to their productions P.
|
Set<NonTerminal> |
getS()
Returns the set of start non terminals S
|
Set<AlphabetSymbol> |
getU()
Gets the set of all terminals and non terminal.
|
Set<NonTerminal> |
getV()
Gets the set of all nonterminals.
|
void |
reduce()
Removes nodes in the graph by removing all nonterminals with only one production using.
|
void |
simplify()
Removes epsilon productions from the language using
EpsilonRemovalVisitor , then removes unit productions
using UnitProductionRemovalVisitor , finally removes useless productions using UselessProductionRemovalVisitor |
public Grammar(dk.brics.automaton.Automaton a)
public Grammar(dk.brics.automaton.Automaton a, boolean lenient)
public Grammar(NonTerminal n)
public void apply(GrammarEntityVisitor v)
v
- the visitor to applypublic Set<Terminal> getEpsilon()
public Map<NonTerminal,Collection<Production>> getP()
public Set<NonTerminal> getS()
public Set<AlphabetSymbol> getU()
public Set<NonTerminal> getV()
public void reduce()
SingleProductionNonTerminalRemovalVisitor
public void simplify()
EpsilonRemovalVisitor
, then removes unit productions
using UnitProductionRemovalVisitor
, finally removes useless productions using UselessProductionRemovalVisitor
Copyright © 2008-2013 Mathias Schwarz.