-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (25 loc) · 847 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
import lex as l
import AST as a
import interpreter as i
import sys
import compiler as cmp
import os
sys.setrecursionlimit(20000) # core dumped at 21804
def main(compile: bool, interpet: bool) -> None:
b = l.lex("youriMain.yo")
x = a.parse(b)
if compile:
cmp.mainCompiler("youriMain", x)
if interpet:
i.interpret(x)
if __name__ == "__main__":
compile = "compile" in sys.argv
interpret = "interpret" in sys.argv
clean = "clean" in sys.argv
if clean:
os.popen('find ./PlatformioProject/src -iname "*.S" -delete')
os.popen('cp PlatformioProject/lib/print.S PlatformioProject/src/')
if compile or interpret:
main(compile, interpret)
elif not clean:
print("No option given\nOptions:\n- compile\n- interpret\n- clean\nEnter multiple options if you want to\n")