comparison python/zcc.py @ 213:003c8a976fff

Merge of semantics and parser again ..
author Windel Bouwman
date Fri, 05 Jul 2013 11:18:48 +0200
parents 8b2f20aae086
children 494828a7adf1
comparison
equal deleted inserted replaced
212:62386bcee1ba 213:003c8a976fff
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import sys, os, argparse 3 import sys, argparse
4 import c3, ppci, codegen 4 import c3, ppci, codegen
5 import arm_cm3 5 import arm_cm3
6 import codegenarm 6 import codegenarm
7 import outstream 7 import outstream
8 8
9 # Parse arguments: 9 # Parse arguments:
10 parser = argparse.ArgumentParser(description='lcfos Compiler') 10 parser = argparse.ArgumentParser(description='lcfos Compiler')
11 parser.add_argument('source', type=argparse.FileType('r'), help='the source file to build') 11 parser.add_argument('source', type=argparse.FileType('r'), \
12 help='the source file to build')
12 parser.add_argument('-d', '--dumpir', action='store_true', help="Dump IR-code") 13 parser.add_argument('-d', '--dumpir', action='store_true', help="Dump IR-code")
13 parser.add_argument('-o', '--output', help='Output file', metavar='filename') 14 parser.add_argument('-o', '--output', help='Output file', metavar='filename')
14 15
15 def main(args): 16 def main(args):
16 # Front end: 17 # Front end:
43 output_filename = 'lc.output' 44 output_filename = 'lc.output'
44 45
45 # TODO: store data 46 # TODO: store data
46 47
47 if __name__ == '__main__': 48 if __name__ == '__main__':
48 args = parser.parse_args() 49 arguments = parser.parse_args()
49 print(args, type(args)) 50 main(arguments)
50 main(args)
51 51