File tree 1 file changed +18
-6
lines changed
1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/python3.5
2
2
3
+ import sys
4
+
3
5
from parser .parser import *
4
6
from execution .execution import *
5
7
8
+ ex = sys .modules ['execution.execution' ]
9
+
10
+ example_filename = 'examples/WIL/push_dup.ws'
11
+
6
12
def get_loop_instructions ():
7
- return loop_instructions = [
13
+ return [
8
14
('push' , 1 ),
9
15
('label' , 0 ),
10
16
'dup' ,
@@ -18,14 +24,20 @@ def get_loop_instructions():
18
24
'end'
19
25
]
20
26
21
- def main ():
22
- pass
23
-
24
- if __name__ == '__main__' :
25
- filename = 'examples/WIL/push_dup.ws'
27
+ def main (filename ):
26
28
p = Parser ()
27
29
c = open (filename , 'r' ).read ()
28
30
content = p .remove_forbidden_chars (c )
29
31
instructions = p .parse (content )
30
32
print (instructions )
31
33
execute (instructions )
34
+
35
+ def usage ():
36
+ print ('usage: ./main.py file_to_execute.ws' )
37
+
38
+ if __name__ == '__main__' :
39
+ ex .DEBUG = False
40
+ if len (sys .argv ) != 2 :
41
+ usage ()
42
+ sys .exit (1 )
43
+ main (sys .argv [1 ])
You can’t perform that action at this time.
0 commit comments