Mercurial > lcfOS
view python/c3/builder.py @ 204:de3a68f677a5
Added long comment to c3 parser
author | Windel Bouwman |
---|---|
date | Fri, 21 Jun 2013 15:01:08 +0200 |
parents | b01429a5d695 |
children | 8b2f20aae086 |
line wrap: on
line source
import ppci from . import Parser, Semantics, TypeChecker, Analyzer, CodeGenerator, AstPrinter class Builder: """ Generates IR-code from c3 source. Reports errors to the diagnostics system """ def __init__(self, diag): self.diag = diag self.parser = Parser(diag) self.tc = TypeChecker(diag) self.al = Analyzer(diag) self.cg = CodeGenerator() self.ap = AstPrinter() def build(self, src): """ Create IR-code from sources """ pkg = self.parser.parseSource(src) if not pkg: return if not self.al.analyzePackage(pkg): return if not self.tc.checkPackage(pkg): return # Only return ircode when everything is OK ircode = self.cg.gencode(pkg) return ircode