-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsinglecc.py
More file actions
28 lines (21 loc) · 735 Bytes
/
singlecc.py
File metadata and controls
28 lines (21 loc) · 735 Bytes
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
import parser.AgentScriptCCLoader as scc
import generator.AgentGenerator as ag
import os.path
import sys
if __name__ == '__main__':
if len(sys.argv) < 2:
print('USAGE: singlecc.py <program.ascript>')
else:
filename = sys.argv[1]
if not os.path.exists(filename):
print('File %s not existing' % filename)
exit(1)
program = scc.parse_file(filename)
if len(program.parsing_errors) > 0:
for error in program.parsing_errors:
print(error)
exit(1)
name = os.path.splitext(os.path.basename(filename))[0]
generator = ag.Generator(name, program)
pyprogram = generator.generate()
print(pyprogram)