Jeremy Hylton | 0c3208a | 2000-03-06 19:13:21 +0000 | [diff] [blame] | 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() |