diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-06-27 19:47:35 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-06-27 19:47:35 -0700 |
commit | 010f5afe311b8a4f52597db2085a3aae49213c68 (patch) | |
tree | b7c55e79fcf7d3134dea2ff13c6d71ba0aaca0b5 /txr.c | |
parent | c7b4483840f371ffe5a531c46492e2cf9c4c6e1e (diff) | |
download | txr-010f5afe311b8a4f52597db2085a3aae49213c68.tar.gz txr-010f5afe311b8a4f52597db2085a3aae49213c68.tar.bz2 txr-010f5afe311b8a4f52597db2085a3aae49213c68.zip |
eval: take macro environment.
With this change we fix the bug that the debugger commands
yield their Lisp forms rather than evaluating them.
* eval.c (eval_intrinsic): Takes one more argument,
the macro environment. This is passed into env_to_menv
as the root macro environment.
(eval_init): Update registration of eval intrinsic
to have two optional arguments.
* eval.h (eval_intrinsic): Declaration updated.
* parser.c (read_file_common, read_eval_ret_last): Pass
nil argument to new parameter of eval_intrinsic.
(repl): Pass the env parameter as the new menv
parameter of eval_intrinsic, rather than the existing
env parameter. This fixes the command dispatch in
the debugger, since the command table is consists of
symbol macros, and not variables. For instance the
backtrace command bt is a binding of the bt symbol
to the form (sys:print-backtrace), which has to be
substituted for it and executed. When that envrionment
is used as the ordinary environment, bt looks like
a variable whose value is the list (sys:backtrace).
* parser.y (elem, check_parse_time_action): Fix
eval_intrinsic calls.
* txr.c (txr_main): Likewise.
* txr.1: Documented.
* y.tab.c.shipped: Updated.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'txr.c')
-rw-r--r-- | txr.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1061,7 +1061,7 @@ int txr_main(int argc, char **argv) if (forms != colon_k) eval_intrinsic(cons(progn_s, forms), - make_env(bindings, nil, nil)); + make_env(bindings, nil, nil), nil); } evaled = t; @@ -1093,7 +1093,7 @@ int txr_main(int argc, char **argv) obj = eval_intrinsic(lisp_parse(arg, std_error, colon_k, lit("cmdline-expr"), colon_k), - make_env(bindings, nil, nil)); + make_env(bindings, nil, nil), nil); gc_hint(obj); pf(z(obj), std_output); |