-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (24 loc) · 820 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
import NativeLibs
instructionSet = {"var ": NativeLibs.var.var, "Si": None}
_currentblocks = []
_currentindent = 0
requireblock = ["Fonction","Si","Sinon","Faire","Pour","Tant"]
def execLine(line:str):
global _currentindent
splitline = line.split(" ")
if splitline[0] in instructionSet and splitline[0] not in requireblock:
instructionSet[splitline[0]](line.replace(str(splitline[0]+" "),""))
elif splitline[0] in requireblock:
_currentindent += 1
_currentblocks.append(_currentindent)
def execfile(path):
with open(path, mode="rb") as f:
content = f.readlines()
f.close()
code = []
for line in content:
code.append(line.decode("utf-8"))
execLine(code)
if __name__ == "__main__":
execfile("test.ExAlgo")
pass