-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
46 lines (30 loc) · 979 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from taskscript.compiler.compiler import Compiler
from taskscript.teacher.teacher import Teacher
def main() -> None:
compiler = Compiler()
teacher = Teacher()
i = 0
print("TaskScript IDLE\n")
while True:
try:
text = input(f"In[{ i }] > ")
if text == "exit":
raise EOFError()
commands = text.split(" ")
action = commands[0]
file = commands[1]
response = ""
output = ""
if len(commands) == 3:
response = commands[2]
if action == "compile":
output = compiler.compile(file)
if action == "correct":
output = teacher.correct(response, file)
print(f"Out[{ i }] > { output }\n")
i += 1
except EOFError:
print("\nBye, bye!\n")
break
if __name__ == "__main__":
main()