mes: Resurrect macros in repl.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 21 Apr 2018 15:30:14 +0000 (17:30 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 21 Apr 2018 15:30:14 +0000 (17:30 +0200)
* src/mes.c (scm_vm_begin_expand): Rename to core:begin-expand.
 (eval_apply): Expose it.
* module/mes/repl.mes (repl): Use it to resurrect macros.

module/mes/repl.mes
src/mes.c

index b59f2bb5fa9c659a25f05d93911721c5f7029be0..ae928c45dd714648ab34095f48af838a3994249d 100644 (file)
@@ -161,7 +161,7 @@ along with Mes.  If not, see <http://www.gnu.org/licenses/>.
                   (loop (mes-load-module-env (cadr sexp) a))
                   (let ((e (if (and (pair? sexp) (eq? (car sexp) (string->symbol "unquote")))
                                (meta (cadr sexp) a)
-                               (eval sexp a))))
+                               (core:eval-expand sexp a))))
                     (if (eq? e *unspecified*) (loop a)
                            (let ((id (string->symbol (string-append "$" (number->string count)))))
                              (set! count (+ count 1))
index fa68ddeb25f0fa29c8129afa005ad8d625f39ea9..fd2f457fb2f639f72b2e5be07b7f7854b8f41767 100644 (file)
--- a/src/mes.c
+++ b/src/mes.c
@@ -207,7 +207,7 @@ struct scm scm_vm_begin_expand_primitive_load = {TSPECIAL, "*vm:core:begin-expan
 struct scm scm_vm_begin_primitive_load = {TSPECIAL, "*vm:core:begin-primitive-load*",0};
 struct scm scm_vm_macro_expand_car = {TSPECIAL, "*vm:core:macro-expand-car*",0};
 struct scm scm_vm_macro_expand_cdr = {TSPECIAL, "*vm:macro-expand-cdr*",0};
-struct scm scm_vm_begin_expand = {TSPECIAL, "*vm:begin-expand*",0};
+struct scm scm_vm_begin_expand = {TSPECIAL, "core:eval-expand",0};
 struct scm scm_vm_begin_expand_eval = {TSPECIAL, "*vm:begin-expand-eval*",0};
 struct scm scm_vm_begin_expand_macro = {TSPECIAL, "*vm:begin-expand-macro*",0};
 struct scm scm_vm_begin = {TSPECIAL, "*vm-begin*",0};
@@ -1040,6 +1040,11 @@ eval_apply ()
               push_cc (CADR (r1), r1, CADDR (r1), cell_vm_return);
               goto eval;
             }
+          case cell_vm_begin_expand:
+            {
+              push_cc (cons (CADR (r1), cell_nil), r1, CADDR (r1), cell_vm_return);
+              goto begin_expand;
+            }
           case cell_call_with_current_continuation:
             {
               r1 = CDR (r1);