This commit is contained in:
deadsmond 2019-11-25 20:56:05 +01:00
parent 2dfadfd588
commit 1793c0db37

View File

@ -6,7 +6,7 @@ import re
class automata: class automata:
# class variables init # class variables init
def __init__(self): def __init__(self):
# dictionary of between nodes # dictionary of connections between nodes
self.graph = {} self.graph = {}
# list of accepting states # list of accepting states
self.accepting_states = [] self.accepting_states = []
@ -76,9 +76,10 @@ auto = automata()
for line in sys.stdin: for line in sys.stdin:
auto.add_node(line) auto.add_node(line)
print(auto)
f = open(sys.argv[1], 'r') f = open(sys.argv[1], 'r')
for line in f: for line in f:
print(auto.test_string(line)) if auto.test_string(line):
print("TRUE %s" % line)
else:
print("FALSE %s" % line)