Mercurial > lcfOS
comparison python/ppci/frontends/ks/__init__.py @ 105:6a303f835c6d
Removed compilers directory
author | Windel Bouwman |
---|---|
date | Mon, 31 Dec 2012 17:35:17 +0100 |
parents | 63937c8d1478 |
children | f2d980eef509 |
comparison
equal
deleted
inserted
replaced
104:ed230e947dc6 | 105:6a303f835c6d |
---|---|
1 """ | |
2 Frontend for the K# language. | |
3 | |
4 This module can parse K# code and create LLVM intermediate code. | |
5 """ | |
6 | 1 |
7 from .parser import KsParser | 2 from .parser import KsParser |
8 from .irgenerator import KsIrGenerator | 3 from .irgenerator import KsIrGenerator |
9 | 4 |
10 class KsFrontend: | 5 class KsFrontend: |
11 def __init__(self): | 6 """ |
12 pass | 7 Frontend for the K# language. |
13 | 8 |
9 This module can parse K# code and create LLVM intermediate code. | |
10 """ | |
11 def __init__(self, context): | |
12 self.context = context | |
13 def compilesource(self, src): | |
14 """ Front end that handles parsing and Module generation """ | |
15 self.errorlist = [] | |
16 # Pass 1: parsing and type checking | |
17 p = KsParser(src) | |
18 ast = p.parseModule() # Parse source into an AST | |
19 | |
20 # Store ast: | |
21 self.ast = ast | |
22 | |
23 # Generate ir (a core.Module): | |
24 ir = KsIrGenerator().generateIr(context, ast) | |
25 | |
26 return ir | |
27 |