aboutsummaryrefslogtreecommitdiff
path: root/src/interp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp.c')
-rw-r--r--src/interp.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/interp.c b/src/interp.c
index 80ddfed..65eeaff 100644
--- a/src/interp.c
+++ b/src/interp.c
@@ -478,6 +478,13 @@ SExpRef lisp_macroexpand1(Interp *interp, SExpRef macro, SExpRef args) {
PUSH_REG(fn);
SExpRef ret = lisp_apply(interp, fn, args, false);
POP_REG();
+ while (VALTYPE(ret) == kTailcallSExp) {
+ fn = REF(ret)->tailcall.fn;
+ args = REF(ret)->tailcall.args;
+ PUSH_REG(ret);
+ ret = lisp_apply(interp, fn, args, false);
+ POP_REG();
+ }
return ret;
error:
return new_error(interp, "macroexpand: syntax error.\n");
@@ -734,6 +741,7 @@ end:
return ret;
}
+
SExpRef lisp_eval(Interp *interp, SExpRef sexp, bool istail) {
if (interp->recursion_depth > 2048) {
return new_error(interp, "eval: stack overflow.\n");