aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/builtins.h2
-rw-r--r--src/interp.c2
-rw-r--r--tests/arithmetic.lisp2
-rw-r--r--tests/tailcall.lisp9
5 files changed, 16 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 5871061..0ac435b 100644
--- a/Makefile
+++ b/Makefile
@@ -8,7 +8,7 @@ ifeq ($(mode), debug)
-g \
-fsanitize=address
else
- cflags = $(includes) -flto -O2
+ cflags = $(includes) -g -flto -O2
endif
src = $(shell find src/ -name '*.c' -not -name 'main.c')
diff --git a/src/builtins.h b/src/builtins.h
index 8568a92..b5a0979 100644
--- a/src/builtins.h
+++ b/src/builtins.h
@@ -3,6 +3,8 @@
#include "interp.h"
+SExpRef builtin_equal(Interp *interp, SExpRef sexp);
+SExpRef builtin_eq(Interp *interp, SExpRef sexp);
SExpRef builtin_format(Interp *interp, SExpRef sexp);
SExpRef builtin_concat(Interp *interp, SExpRef sexp);
SExpRef builtin_print(Interp *interp, SExpRef sexp);
diff --git a/src/interp.c b/src/interp.c
index df995ca..ba8ba95 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -776,6 +776,8 @@ SExpRef new_binding(Interp *interp, SExpRef sym, SExpRef val) {
REF(ret)->type = kBindingSExp;
REF(ret)->binding.name = sym;
REF(ret)->binding.value = val;
+ REF(ret)->binding.func = unbound;
+ REF(ret)->binding.next = NIL;
return ret;
}
diff --git a/tests/arithmetic.lisp b/tests/arithmetic.lisp
index 05459f6..6175705 100644
--- a/tests/arithmetic.lisp
+++ b/tests/arithmetic.lisp
@@ -14,6 +14,8 @@
(assert (>= 2 1))
(assert (>= 1 1))
(assert (not (>= 0 1)))
+(assert (/= 2 1.0))
+(assert (not (/= 1 1)))
(assert-error (+ 1 "a"))
(assert-error (- 1 "a"))
diff --git a/tests/tailcall.lisp b/tests/tailcall.lisp
index 8cea496..86a88c8 100644
--- a/tests/tailcall.lisp
+++ b/tests/tailcall.lisp
@@ -12,6 +12,15 @@
(assert (is-odd 1))
(assert (is-even 2))
+(defun cnt-down (x)
+ (if (= x 0)
+ #t
+ (progn
+ (cnt-down (- x 1)))))
+
+(assert (cnt-down 10000))
+
;; can pass without stack overflow,
;; but comment out for too time-consuming
;; (assert (is-even 1000000))
+;; (assert (cnt-down 1000000))