def getTransitions(k, alpha, file, w): alphabet = set(str(alpha)) dfa = DFA(k, alphabet) M = dfa.constructDFA() Ti = dfa.getTransitions(M, w) f = open(file, 'w') f.write("Ti=%s\n" % strDict(Ti)) f.close() return
def getTransitions(k, alpha, file, w): alphabet = set(str(alpha)) dfa = DFA(k, alphabet) M = dfa.constructDFA() Ti = dfa.getTransitions(M, w) f = open(file, "w") f.write("Ti=%s\n" % strDict(Ti)) f.close() return
def getAcceptState(k, alpha, file, TiStr): alphabet = set(str(alpha)) dfa = DFA(k, alphabet) M = dfa.constructDFA() Ti = eval(TiStr) x = dfa.getAcceptState(Ti) f = open(file, 'w') f.write("x=%s\n" % x) f.close() return
def getAcceptState(k, alpha, file, TiStr): alphabet = set(str(alpha)) dfa = DFA(k, alphabet) M = dfa.constructDFA() Ti = eval(TiStr) x = dfa.getAcceptState(Ti) f = open(file, "w") f.write("x=%s\n" % x) f.close() return
def isStrAccept(k, alpha, file, w): alphabet = set(str(alpha)) dfa = DFA(k, alphabet) M = dfa.constructDFA() res = dfa.accept(M, w) if res: i = 1 else: i = 0 f = open(file, 'w') f.write("accept=%s\n" % i) f.close() return
def constructDFA(k, alpha, file): alphabet = set(str(alpha)) dfa = DFA(k, alphabet) M = dfa.constructDFA() Q, S, T, q0, F = M f = open(file, 'w') f.write("Q=%s\n" % strList(Q)) f.write("T=%s\n" % strList(T)) f.write("q0=%s\n" % q0) f.write("F=%s\n" % strList(F)) f.close() return
def constructDFA(k, alpha, file): alphabet = set(str(alpha)) dfa = DFA(k, alphabet) M = dfa.constructDFA() Q, S, T, q0, F = M f = open(file, "w") f.write("Q=%s\n" % strList(Q)) f.write("T=%s\n" % strList(T)) f.write("q0=%s\n" % q0) f.write("F=%s\n" % strList(F)) f.close() return
def isStrAccept(k, alpha, file, w): alphabet = set(str(alpha)) dfa = DFA(k, alphabet) M = dfa.constructDFA() res = dfa.accept(M, w) if res: i = 1 else: i = 0 f = open(file, "w") f.write("accept=%s\n" % i) f.close() return