Mercurial > lcfOS
view python/c3/builder.py @ 169:ee0d30533dae
Added more tests and improved the diagnostic update
author | Windel Bouwman |
---|---|
date | Sat, 23 Mar 2013 18:34:41 +0100 |
parents | 49f1ab80d040 |
children | 46d62dadd61b |
line wrap: on
line source
import ppci from . import Parser, Semantics, TypeChecker, Analyzer, CodeGenerator, AstPrinter class Builder: def __init__(self, diag): self.diag = diag self.p = Parser(diag) self.tc = TypeChecker(diag) self.al = Analyzer(diag) self.cg = CodeGenerator() self.ap = AstPrinter() def build(self, src): # Store src for later: self.src = src self.pkg = self.p.parseSource(src) self.al.analyzePackage(self.pkg) self.tc.checkPackage(self.pkg) ok = len(self.diag.diags) == 0 if ok: i = self.cg.gencode(self.pkg) return i