comparison python/zcc.py @ 289:bd2593de3ff8

Semifix burn2
author Windel Bouwman
date Thu, 21 Nov 2013 15:46:50 +0100
parents a747a45dcd78
children 7b38782ed496
comparison
equal deleted inserted replaced
288:a747a45dcd78 289:bd2593de3ff8
10 import codegenarm 10 import codegenarm
11 from optimize import optimize 11 from optimize import optimize
12 import outstream 12 import outstream
13 import hexfile 13 import hexfile
14 14
15
15 logformat='%(asctime)s|%(levelname)s|%(name)s|%(message)s' 16 logformat='%(asctime)s|%(levelname)s|%(name)s|%(message)s'
17
16 18
17 def logLevel(s): 19 def logLevel(s):
18 numeric_level = getattr(logging, s.upper(), None) 20 numeric_level = getattr(logging, s.upper(), None)
19 if not isinstance(numeric_level, int): 21 if not isinstance(numeric_level, int):
20 raise ValueError('Invalid log level: {}'.format(s)) 22 raise ValueError('Invalid log level: {}'.format(s))
21 return numeric_level 23 return numeric_level
24
22 25
23 # Parse arguments: 26 # Parse arguments:
24 parser = argparse.ArgumentParser(description='lcfos Compiler') 27 parser = argparse.ArgumentParser(description='lcfos Compiler')
25 # Input: 28 # Input:
26 parser.add_argument('source', type=argparse.FileType('r'), \ 29 parser.add_argument('source', type=argparse.FileType('r'), \
49 if not ircode: 52 if not ircode:
50 return 53 return
51 54
52 # Optimization passes: 55 # Optimization passes:
53 optimize(ircode) 56 optimize(ircode)
54 57
55 if dumpir: 58 if dumpir:
56 ircode.dump() 59 ircode.dump()
57 60
58 # TODO select target here! 61 # TODO select target here!
59 # Code generation: 62 # Code generation: