diff options
author | Camil Staps | 2018-12-25 00:00:45 +0100 |
---|---|---|
committer | Camil Staps | 2018-12-25 00:00:45 +0100 |
commit | 8afc5e6b37b4b212f7ffb85e7bca6b0dad6c12a0 (patch) | |
tree | 281cbde504097b12505e9d9793705f6189e3a4c8 /Sjit/Compile.icl | |
parent | Add interactive shell (diff) |
Add booleans, encoded as 1 and 0
Diffstat (limited to 'Sjit/Compile.icl')
-rw-r--r-- | Sjit/Compile.icl | 1 |
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 +++ "'") |