Compile multi-expression source programs

This commit is contained in:
greg 2017-01-10 01:34:08 -08:00
parent db108ee434
commit 12fbc51da1
2 changed files with 10 additions and 3 deletions

View File

@ -1,4 +1,5 @@
が = 80
a = 1
b = 2
a + b
a + b + が

View File

@ -88,8 +88,14 @@ trait CodeGen {
impl CodeGen for AST {
fn codegen(&self, data: &mut CompilationData) -> LLVMValueRef {
let first = self.get(0).unwrap();
first.codegen(data)
let int_type = LLVMWrap::Int64TypeInContext(data.context);
let mut ret = LLVMWrap::ConstInt(int_type, 0, false);
for statement in self {
ret = statement.codegen(data);
}
ret
}
}