return "";
}
public Grammar generateType3Grammar() {
Grammar g = new Grammar(new Nonterminal(new StringBuffer(this.initialState)));
LinkedList<String> reachableStates = new LinkedList<>(this.getAllReachableStates());
Collections.sort(reachableStates);
for (String fromState : reachableStates) {
for (Transition targetTransition : this.getTransitionsFrom(fromState)) {
String toState = targetTransition.getDestination();
String symbol = targetTransition.getLabel();
g.addRule(new Rule(
new Word(new Symbol[] {new Nonterminal(new StringBuffer(fromState))}),
new Word(new Symbol[] {
new Terminal(new StringBuffer(symbol)),
new Nonterminal(new StringBuffer(toState))})));
}
if (this.finalStates.contains(fromState)) {
g.addRule(new Rule(
new Word(new Symbol[] {new Nonterminal(new StringBuffer(fromState))}),
new Word(new Symbol[] {})));
}
}
return g;