mes: Resurrect macros in repl.

* 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.
This commit is contained in:
Jan Nieuwenhuizen 2018-04-21 17:30:14 +02:00
parent 833fe991cb
commit 7ecec93a88
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 7 additions and 2 deletions

View 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))

View file

@ -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);