Mercurial > lcfOS
view python/ppci/frontends/ks/__init__.py @ 106:f2d980eef509
improved code generation
author | Windel Bouwman |
---|---|
date | Mon, 31 Dec 2012 18:26:56 +0100 |
parents | 6a303f835c6d |
children | 9e552d34bd60 |
line wrap: on
line source
from .parser import KsParser from .irgenerator import KsIrGenerator class KsFrontend: """ Frontend for the K# language. This module can parse K# code and create LLVM intermediate code. """ def __init__(self, context): self.context = context def compilesource(self, src): """ Front end that handles parsing and Module generation """ self.errorlist = [] # Pass 1: parsing and type checking p = KsParser(src) ast = p.parseModule() # Parse source into an AST # Store ast: self.ast = ast # Generate ir (a core.Module): ir = KsIrGenerator().generateIr(self.context, ast) return ir