forked from alcides/pascal-in-python
-
Notifications
You must be signed in to change notification settings - Fork 1
/
kpascal
executable file
·37 lines (26 loc) · 968 Bytes
/
kpascal
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
#!/usr/bin/env python
from optparse import OptionParser
from src.parser import main
parser = OptionParser()
parser.add_option("-o", "--out", dest="filename", default=False,
help="write output to <filename>", metavar="<filename>")
parser.add_option("-e", "--emit",
action="store_true", dest="verbose", default=False,
help="prints the bytecode to the screen")
parser.add_option("-g", "--graph",
action="store_true", dest="graph", default=False,
help="shows the AST graph")
parser.add_option("-i", "--instant",
action="store_true", dest="run", default=False,
help="runs the result instead of saving")
(options, args) = parser.parse_args()
if not options.filename:
if len(args) > 0:
options.filename = args[0].replace(".p",".out")
else:
options.filename = "a.out"
if len(args) > 0:
f = args[0]
else:
f = False
main(options,f)