def prob6(input, output): f = open(input, 'r'); choice = int(f.readline()); if choice == 0: FA = SDK.readDFAtable(f); Project_06.drawDFA(FA, output) else: FA = SDK.readEpsNFAtable(f); Project_06.drawNFA(FA, output) f.close();
def prob4(input, output): #def readDFAtable(f): #return (allState, alphabet, startingState, dfaTable, acceptedState) #input f = open(input, 'r'); myDFA = SDK.readDFAtable(f); f.close(); s = Project_04.DfaToRE(myDFA); g = open(output, 'w'); g.write(s); g.close();
def prob1(input, output): #input f = open(input, 'r'); myDFA = SDK.readDFAtable(f); str = f.readline(); f.close(); g = open(output, 'w'); if Project_01.isAcceptedString(myDFA): g.write('Accepted'); else: g.write('Not accepted'); g.close();
def prob5(input, output): #input f = open(input, 'r'); #allState, alphabet, startingState, dfaTable, acceptedState myDFA = SDK.readDFAtable(f); f.close(); #-------------------------------------------------------------------- #init #newAcceptedState = [u for u in newAcceptedState] DFA = Project_05.reduceDFA(myDFA); #print output g = open(output, 'w'); SDK.writeDFAtable(g, DFA); #g.write('Description\n'); #for u in newAllState: #g.write(str(u) + ': ' + ' '.join(map(str, [v for v in allState if id[v] == u])) + '\n') g.close();