Mercurial > lcfOS
comparison python/zcc.py @ 296:9417caea2eb3
Directorized some backend files
author | Windel Bouwman |
---|---|
date | Sun, 01 Dec 2013 13:36:58 +0100 |
parents | 6aa721e7b10b |
children | 158068af716c |
comparison
equal
deleted
inserted
replaced
295:917eab04b8b7 | 296:9417caea2eb3 |
---|---|
30 parser = argparse.ArgumentParser(description='lcfos Compiler') | 30 parser = argparse.ArgumentParser(description='lcfos Compiler') |
31 # Input: | 31 # Input: |
32 parser.add_argument('source', type=argparse.FileType('r'), \ | 32 parser.add_argument('source', type=argparse.FileType('r'), \ |
33 help='the source file to build', nargs="+") | 33 help='the source file to build', nargs="+") |
34 parser.add_argument('-i', '--imp', type=argparse.FileType('r'), \ | 34 parser.add_argument('-i', '--imp', type=argparse.FileType('r'), \ |
35 help='Possible import module', action='append') | 35 help='Possible import module', action='append', default=[]) |
36 | 36 |
37 parser.add_argument('--dumpir', action='store_true', help="Dump IR-code") | 37 parser.add_argument('--dumpir', action='store_true', help="Dump IR-code") |
38 parser.add_argument('--dumpasm', action='store_true', help="Dump ASM-code") | 38 parser.add_argument('--dumpasm', action='store_true', help="Dump ASM-code") |
39 parser.add_argument('--optimize', action='store_true', help="Optimize") | 39 parser.add_argument('--optimize', action='store_true', help="Optimize") |
40 parser.add_argument('--target', help="Backend selection", | 40 parser.add_argument('--target', help="Backend selection", |
78 return c3b.ok | 78 return c3b.ok |
79 | 79 |
80 | 80 |
81 def main(args): | 81 def main(args): |
82 logging.basicConfig(format=logformat, level=args.log) | 82 logging.basicConfig(format=logformat, level=args.log) |
83 src = args.source | |
84 imps = args.imp | |
85 if not imps: | |
86 imps = [] | |
87 tg = targets[args.target] | 83 tg = targets[args.target] |
88 diag = ppci.DiagnosticsManager() | 84 diag = ppci.DiagnosticsManager() |
89 outs = outstream.TextOutputStream() | 85 outs = outstream.TextOutputStream() |
90 | 86 |
91 res = zcc(src, imps, tg, outs, diag, dumpir=args.dumpir) | 87 res = zcc(args.source, args.imp, tg, outs, diag, dumpir=args.dumpir) |
92 if not res: | 88 if not res: |
93 diag.printErrors() | 89 diag.printErrors() |
94 return 1 | 90 return 1 |
95 | 91 |
96 if args.dumpasm: | 92 if args.dumpasm: |