From 12fbc51da1d345b5f8c5b09c11584c344e1fa469 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 10 Jan 2017 01:34:08 -0800 Subject: [PATCH] Compile multi-expression source programs --- compile.schala | 3 ++- src/compilation.rs | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/compile.schala b/compile.schala index 98c6ce0..42db015 100644 --- a/compile.schala +++ b/compile.schala @@ -1,4 +1,5 @@ +が = 80 a = 1 b = 2 -a + b +a + b + が diff --git a/src/compilation.rs b/src/compilation.rs index e775dcd..d742eae 100644 --- a/src/compilation.rs +++ b/src/compilation.rs @@ -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 } }