net.hydromatic.clapham.graph
Class Grammar
java.lang.Object
net.hydromatic.clapham.graph.Grammar
public class Grammar
- extends Object
TODO:
- Since:
- Aug 26, 2008
- Author:
- jhyde
-
-
symbolMap
public final Map<String,Symbol> symbolMap
ruleMap
public final Map<Symbol,Graph> ruleMap
TRACE
public static boolean TRACE
terminals
public final List<Symbol> terminals
nonterminals
public final List<Symbol> nonterminals
Grammar
public Grammar()
setOptimizeGraph
public void setOptimizeGraph(boolean value)
setOptimizeGraph
public boolean setOptimizeGraph()
optimize
public void optimize()
- calls all methods which optimize the graphs
checkSubAlts
public void checkSubAlts(Node alt)
makeEpsilon
public void makeEpsilon(Graph g)
makeFirstAlt
public void makeFirstAlt(Graph g)
makeAlternative
public void makeAlternative(Graph g1,
Graph g2)
makeSequence
public void makeSequence(Graph g1,
Graph g2)
makeIteration
public void makeIteration(Graph g)
makeOption
public void makeOption(Graph g)
find
public Node find(String name)
- Finds a terminal or non-terminal with a given name.
- Parameters:
name
- Name of symbol
- Returns:
- terminal or non-terminal
terminalToNt
public void terminalToNt(String name)
- Converts the terminal with a given name to a non-terminal.
- Parameters:
name
- Name of non-terminal.
printNodes
public void printNodes(PrintStream out)