aboutsummaryrefslogtreecommitdiff
path: root/Sjit/Compile.icl
diff options
context:
space:
mode:
authorCamil Staps2018-12-25 00:00:45 +0100
committerCamil Staps2018-12-25 00:00:45 +0100
commit8afc5e6b37b4b212f7ffb85e7bca6b0dad6c12a0 (patch)
tree281cbde504097b12505e9d9793705f6189e3a4c8 /Sjit/Compile.icl
parentAdd interactive shell (diff)
Add booleans, encoded as 1 and 0
Diffstat (limited to 'Sjit/Compile.icl')
-rw-r--r--Sjit/Compile.icl1
1 files changed, 1 insertions, 0 deletions
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 +++ "'")