From 8afc5e6b37b4b212f7ffb85e7bca6b0dad6c12a0 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Tue, 25 Dec 2018 00:00:45 +0100 Subject: Add booleans, encoded as 1 and 0 --- Sjit/Compile.icl | 1 + 1 file changed, 1 insertion(+) (limited to 'Sjit/Compile.icl') diff --git a/Sjit/Compile.icl b/Sjit/Compile.icl index 5e4cef5..96db7f2 100644 --- a/Sjit/Compile.icl +++ b/Sjit/Compile.icl @@ -102,6 +102,7 @@ compile f cs where expr :: !Expr !CompileState -> Either String (![Instr], !CompileState) expr (Int i) cs = Right ([PushI i], {cs & sp=cs.sp+1, pc=cs.pc+1}) + expr (Bool b) cs = Right ([PushI (if b 1 0)], {cs & sp=cs.sp+1, pc=cs.pc+1}) expr (Var v) cs = case get v cs.vars of Just i -> Right ([PushRef (i-cs.sp)], {cs & sp=cs.sp+1, pc=cs.pc+1}) Nothing -> Left ("undefined variable '" +++ v +++ "'") -- cgit v1.2.3