-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
76 lines (48 loc) · 1.58 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# here you can call you functions
from initial_vals import *
from subunits import *
import traceback
tab = Tables_Values(root=True)
pars = Parser_Function(tab)
file = r'testcases\final\05_bool.lol'
f = open( file, 'r')
tab.file = file
tab.code = f.readlines()
tab.row = 0
tab.line = tab.code[tab.row]
"""
Instructions in getting the classes up and running
1. Build your class in .\subunits folder
2. make sure that import your class in .\subunits\__init__.py
3. add the abtractions and regex in .\init_vals\parser_function.py
in self.cfg variablew
"""
try:
pars.get_rid_multiple_lines()
pars.get_rid("^HAI ?", "code initialized", "No lolcode initailization, Add the keyword 'HAI'")
pars.get_rid_new_line()
while True:
pars.get_rid_multiple_lines()
pars.get_rid_spacing()
if not pars.get_rid("^HOW IZ I ", "function", match=True):
break
pars.get_lexemes(["function"])
pars.get_rid("^WAZZUP ?", "variables initailization","Variables sould be initialized using 'WAZZUP'" )
Variable(tab, pars).main()
pars.get_rid_multiple_lines()
while True:
pars.get_rid_multiple_lines()
pars.get_rid_spacing()
if pars.get_lexemes(["terminate"], False):
break
pars.get_lexemes(["expression","boolean","infinite","statement"])
except SyntaxError:
print("\n")
print(tab.function)
print(" -------TERMINAL----")
# change your printing here
print(tab.terminal)
except Exception as error:
print("\n")
print(error)
traceback.print_exc()