def getNFA(self): self.getValuesFromTable() tempNode = self.getInitialState() _nfa = nfa(self.arr_nodos, tempNode, self.fstates) _nfa.toDFA()
import reader from nfa2regexp import * from nfa import * import hachoir_regex as ha foo = nfa(*reader.parse_head_file("examples/baaplus.head")) conv = converter(foo) conv.convert() reg = [a for a in conv.edges[-1] if conv.edges[conv.B][a] == [conv.E]][0] print reg
#!/usr/bin/env python import re, sys, os from reader import * from nfa import * filename = "baaplus.head" if __name__ == '__main__': if len(sys.argv) > 1: filename = sys.argv[1] test = nfa(*parse_head_file(filename)) f, ext = os.path.splitext(filename) test.graphviz(f)