コード例 #1
0
ファイル: callPyDFA.py プロジェクト: vusirikala/auto-tools
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
コード例 #2
0
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
コード例 #3
0
ファイル: callPyDFA.py プロジェクト: vusirikala/auto-tools
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
コード例 #4
0
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
コード例 #5
0
ファイル: callPyDFA.py プロジェクト: vusirikala/auto-tools
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
コード例 #6
0
ファイル: callPyDFA.py プロジェクト: vusirikala/auto-tools
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
コード例 #7
0
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
コード例 #8
0
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