core: Have core:eval expand macros.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 28 Apr 2018 16:31:10 +0000 (18:31 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sat, 28 Apr 2018 16:31:10 +0000 (18:31 +0200)
* src/mes.c (core:eval-expand): Remove
  (core:eval-expanded): New variable.
  (eval_apply): Have core:eval expand macros; core:eval-expanded evals
  expanded sexps.

module/mes/repl.mes
scaffold/mini-mes.c
src/mes.c

index 206dbe84efeebb7cab0df91eb20eaf0d4d0a2e20..fef9a0e9d26619f01498e043bf72867aa29bd715 100644 (file)
@@ -165,15 +165,15 @@ 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)
-                               (core:eval-expand sexp a))))
+                               (core:eval sexp a))))
                     (if (eq? e *unspecified*) (loop a)
-                           (let ((id (string->symbol (string-append "$" (number->string count)))))
-                             (set! count (+ count 1))
-                             (display id)
-                             (display " = ")
-                             (write e)
-                             (newline)
-                             (loop (acons id e a)))))))))
+                        (let ((id (string->symbol (string-append "$" (number->string count)))))
+                          (set! count (+ count 1))
+                          (display id)
+                          (display " = ")
+                          (write e)
+                          (newline)
+                          (loop (acons id e a)))))))))
         (lambda (key . args)
           (if (defined? 'with-output-to-string)
               (simple-format (current-error-port) "exception:~a:~a\n" key args)
index 88b70c4afe4086e378f4eb12eb028028d889402b..1a9e2abfd147370eeac51c90ea0a7ccaa627ff5e 100644 (file)
@@ -143,7 +143,7 @@ struct scm scm_vm_evlis2 = {TSPECIAL, "*vm-evlis2*",0};
 struct scm scm_vm_evlis3 = {TSPECIAL, "*vm-evlis3*",0};
 struct scm scm_vm_apply = {TSPECIAL, "core:apply",0};
 struct scm scm_vm_apply2 = {TSPECIAL, "*vm-apply2*",0};
-struct scm scm_vm_eval = {TSPECIAL, "core:eval",0};
+struct scm scm_vm_eval = {TSPECIAL, "core:eval-sexp",0};
 
 struct scm scm_vm_eval_pmatch_car = {TSPECIAL, "*vm-eval-pmatch-car*",0};
 struct scm scm_vm_eval_pmatch_cdr = {TSPECIAL, "*vm-eval-pmatch-cdr*",0};
@@ -163,7 +163,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, "core:eval-expand",0};
+struct scm scm_vm_begin_expand = {TSPECIAL, "core:eval",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};
index 4f787929a016363ad02b7bb303716abc882b8119..4cfa27c922fbeb907af2e56f094ae8ff17a07e7a 100644 (file)
--- a/src/mes.c
+++ b/src/mes.c
@@ -185,7 +185,7 @@ struct scm scm_vm_evlis2 = {TSPECIAL, "*vm-evlis2*",0};
 struct scm scm_vm_evlis3 = {TSPECIAL, "*vm-evlis3*",0};
 struct scm scm_vm_apply = {TSPECIAL, "core:apply",0};
 struct scm scm_vm_apply2 = {TSPECIAL, "*vm-apply2*",0};
-struct scm scm_vm_eval = {TSPECIAL, "core:eval",0};
+struct scm scm_vm_eval = {TSPECIAL, "core:eval-expanded",0};
 
 struct scm scm_vm_eval_pmatch_car = {TSPECIAL, "*vm-eval-pmatch-car*",0};
 struct scm scm_vm_eval_pmatch_cdr = {TSPECIAL, "*vm-eval-pmatch-cdr*",0};
@@ -205,7 +205,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, "core:eval-expand",0};
+struct scm scm_vm_begin_expand = {TSPECIAL, "core:eval",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};