Fix "if" condition
diff --git a/src/lisp/compiler.dasc b/src/lisp/compiler.dasc
index e5a9444..2ac21f3 100644
--- a/src/lisp/compiler.dasc
+++ b/src/lisp/compiler.dasc
@@ -64,11 +64,13 @@
|.actionlist lisp_actions;
dasm_setup(&d, lisp_actions);
- dasm_growpc(&d, npc);
-
struct local local;
local.first = NULL;
local.num_vars = 0;
+ local.npc = 8;
+ local.nextpc = 0;
+
+ dasm_growpc(&d, local.npc);
// Generate code
@@ -158,7 +160,7 @@
| je =>false_label;
compile_expression(env, local, elt(args, 1), Dst);
-
+ | jmp =>after_label;
|=>false_label:
if (nargs == 3)
compile_expression(env, local, elt(args, 2), Dst);
diff --git a/src/lisp/test.lisp b/src/lisp/test.lisp
index 82e5955..6f4abb8 100644
--- a/src/lisp/test.lisp
+++ b/src/lisp/test.lisp
@@ -1,7 +1,12 @@
(defun two-plus-two ()
(+ 2 2))
-(defun main ()
+(defun hmm-main ()
(print "64 / (2 + 2) =")
(print (/ 64 (two-plus-two)))
(print nil))
+
+(defun main ()
+ (if t
+ (print 1)
+ (print 2)))