Mercurial > lcfOS
diff python/c3/codegenerator.py @ 261:444b9df2ed99
try to split up code generation
author | Windel Bouwman |
---|---|
date | Fri, 09 Aug 2013 09:05:13 +0200 |
parents | ac603eb66b63 |
children | 5ec7580976d9 |
line wrap: on
line diff
--- a/python/c3/codegenerator.py Tue Aug 06 18:29:53 2013 +0200 +++ b/python/c3/codegenerator.py Fri Aug 09 09:05:13 2013 +0200 @@ -9,9 +9,10 @@ '&':'and', '>>':'shl', '<<':'shr'} class CodeGenerator: + """ Generates intermediate code from a package """ def __init__(self): - self.logger = logging.getLogger('c3') - """ Generates intermediate code from a package """ + self.logger = logging.getLogger('c3cgen') + def gencode(self, pkg): assert type(pkg) is astnodes.Package self.logger.info('Generating ir-code for {}'.format(pkg.name)) @@ -101,6 +102,7 @@ self.builder.setBB(te) else: print('Unknown stmt:', code) + raise NotImplementedError() def genCondCode(self, expr, bbtrue, bbfalse): # Implement sequential logical operators @@ -130,6 +132,7 @@ self.builder.addIns(ir.Branch(bbfalse)) else: print('Unknown cond', expr) + raise NotImplementedError() def cast_to_rvalue(self, expr, loc): """ Cast lvalue to rvalue if required """