Compile multi-expression source programs
This commit is contained in:
parent
db108ee434
commit
12fbc51da1
@ -1,4 +1,5 @@
|
|||||||
|
が = 80
|
||||||
a = 1
|
a = 1
|
||||||
b = 2
|
b = 2
|
||||||
a + b
|
a + b + が
|
||||||
|
|
||||||
|
@ -88,8 +88,14 @@ trait CodeGen {
|
|||||||
|
|
||||||
impl CodeGen for AST {
|
impl CodeGen for AST {
|
||||||
fn codegen(&self, data: &mut CompilationData) -> LLVMValueRef {
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user