From 552f09db0d73eca583d297abd7114462fd87646d Mon Sep 17 00:00:00 2001 From: pimjager Date: Mon, 9 May 2016 11:58:50 +0200 Subject: [PATCH] Work in progress code gen --- examples/codeGen.spl | 5 ++++- gen.icl | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/codeGen.spl b/examples/codeGen.spl index 1f8cbfd..fe4c77f 100644 --- a/examples/codeGen.spl +++ b/examples/codeGen.spl @@ -1,4 +1,7 @@ +f() { + return 2; +} main() { var x = 3; - return 4 + 2 + x; + return 1 + 2 + x + f(); } \ No newline at end of file diff --git a/gen.icl b/gen.icl index 9145ee5..0fc8bc0 100644 --- a/gen.icl +++ b/gen.icl @@ -64,8 +64,14 @@ gen (AST fds) = case evalRWST prog "" ('Map'.newMap, labelStream) of // ,Instr "ldc" [Lit 1] "Eerste instructie" // ,Instr "ldc" [Lit 2] "Tweede instructie"] -//TODO: -//For now in the generation we assume all vars fit on the stack... +//Current issues: +//All VarDecls are added as function, how to deal with assignments? +// (And when we deal with assignments, how to deal with assignments to higher order functions?) +//Dealing with arguments +//Dealing with types that do not fit on the Stack +// Probably completely change LoadPlace to a Type and a position relative to *something* +// And where the type determines if this position is a pointer to the heap or an +// unboxed value //helper functions for the gen monad genMap :: Gen GenMap -- 2.20.1