from compiler import compile, visitor
-##import profile
+import profile
def main():
VERBOSE = 0
DISPLAY = 0
+ PROFILE = 0
CONTINUE = 0
- opts, args = getopt.getopt(sys.argv[1:], 'vqdc')
+ opts, args = getopt.getopt(sys.argv[1:], 'vqdcp')
for k, v in opts:
if k == '-v':
VERBOSE = 1
DISPLAY = 1
if k == '-c':
CONTINUE = 1
+ if k == '-p':
+ PROFILE = 1
if not args:
print "no files to compile"
else:
if VERBOSE:
print filename
try:
- compile(filename, DISPLAY)
-## profile.run('compile(%s, %s)' % (`filename`, `DISPLAY`),
-## filename + ".prof")
+ if PROFILE:
+ profile.run('compile(%s, %s)' % (`filename`, `DISPLAY`),
+ filename + ".prof")
+ else:
+ compile(filename, DISPLAY)
+
except SyntaxError, err:
print err
print err.lineno