Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c3208a

Browse files
committed
compiler command-line interface moved here from compiler.pycodegen
1 parent f728f9a commit 0c3208a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Tools/compiler/compile.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import sys
2+
import getopt
3+
4+
from compiler import compile, visitor
5+
6+
def main():
7+
VERBOSE = 0
8+
opts, args = getopt.getopt(sys.argv[1:], 'vq')
9+
for k, v in opts:
10+
if k == '-v':
11+
VERBOSE = 1
12+
visitor.ASTVisitor.VERBOSE = visitor.ASTVisitor.VERBOSE + 1
13+
if k == '-q':
14+
f = open('/dev/null', 'wb')
15+
sys.stdout = f
16+
if not args:
17+
print "no files to compile"
18+
else:
19+
for filename in args:
20+
if VERBOSE:
21+
print filename
22+
compile(filename)
23+
24+
if __name__ == "__main__":
25+
main()

0 commit comments

Comments
 (0)