| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/011/macros-1.expected: New file.
* tests/011/macros-1.txr: New file.
* tests/011/macros-2.expected: New file.
* tests/011/macros-2.txr: New file.
* tests/011/special-1.expected: New file.
* tests/011/special-1.txr: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (expand_vars): Expand vars needs to know whether it's
handling a sequential (let*-like) or parallel (let-like) binding.
The init form of a variable sees the previous macro environment,
but that variable must, for the remaining variables, shadow any
previous symbol macro.
(expand): In expand we must inform expand_vars whether we have
a sequential or parallel binding construct. Moreover, there was
a huge bug here: the new_menv (with the shadows) was passed to
expand_vars, so that all the variables were hiding same-named
symbol macros from all their initforms.
|
|
|
|
|
|
|
|
| |
(eval_init): Initialiation of delay_s removed.
Symbol now interned in reg_mac call for registering me_delay .
* genvim.txr: Updated to recognize a reg_mac call
with intern.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
by Roman Mishin.
|
|
|
|
|
| |
as having trailing junk. The fix is to put the junk-matching rule after
the valid rules.
|
|
|
|
|
|
|
|
| |
* lib.h (copy): Declared.
* eval.c (eval_init): Registered copy function as intrinsic.
* txr.1: Added missing documentation for length. Documented copy.
|
| |
|
| |
|
|
|
|
|
|
|
| |
in eval_init. Also, scans reg_mac registrations now.
* txr.vim: Refreshed. The previously missed "delay" operator is now
listed, thanks to reg_mac.
|
|
|
|
|
| |
(expand_macrolet, expand_symacrolet): Use maybe_progn
to eliminate unnecessary progn wrapping.
|
|
|
|
|
|
|
|
| |
(me_gun): New static function.
(eval_init): New gun symbol interened, me_gun registered
as intrinsic macro.
* txr.1: Documented gun.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
formal macros that are in the top_mb table, make their symbols
fboundp and can be expanded with macroexpand.
* eval.c (mefun_t): New typedef name.
(expand_macro): If the expander is a cobj, then pull out the C function
and call it, otherwise realize the interpreted macro as before.
(me_gen, me_delay): New static functions, replace expand_gen
and expand_delay.
(expand_qquote): Renamed to me_quote.
(expand_gen, expand_delay): Renamed to me_gen and me_delay,
with an interface adjustment and moved.
(expand_op): Renamed to me_op.
(expand): Removed qquote, gen, delay, op, and do handling, since
these operators are now macros.
Removed the unnecessary expansion of with-saved-vars.
(reg_op, reg_fun): Assert that the symbol is not nil, to catch
initialization order issues. One just showed up: op_do was
interned in match.c, which is initialized later.
(reg_mac): New static function
(eval_init): Intern do_s, because match.c hasn't done it yet
at this point. Register me_gen, me_delay, me_op (twice) and me_qquote
as intrinsic macros.
* txr.1: Documented those operators as macros.
|
|
|
|
|
| |
(eval_init): Register operators with reg_op instead of direct sethash
calls.
|
|
|
|
|
|
| |
a character, then don't try to make it into a string;
keep it as a list. This allows [mapcar list "abc" "def"]
to work intuitively rather than blow up.
|
|
|
|
|
|
|
| |
(code2type): Return lit_s for LIT type.
(typeof): Return lit_s for TAG_LIT.
(replace_str): Error message wording.
(obj_init): lit_s interned.
|
|
|
|
| |
dispatching function, so it is not clobbered by argument evaluations.
|
|
|
|
|
|
|
|
|
|
|
|
| |
dwim_body, since the append2 copies list structure.
* parser.y (n_exprs): propagate source loc info from both
constituents, giving precedence to the left one, rather than just taking
it from the left one and ignoring the second constituent. This fixes
cases of missing location info. The left constituent n_expr is often
a symbol, and those do not have location info. We want a case like
like ((x) y) to take from (x), and (x (y)) to take it from (y),
and so on.
|
|
|
|
|
|
|
| |
from the @ token.
(n_expr): Bugfix: do not attribute a symbol with location info.
(quasilit): Obtain location info from quasi_items, and only
if that is unavailable, then from lineno.
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
* RELNOTES, txr.vim: Updated.
|
|
|
|
| |
for the context string that serves in place of a filename.
|
|
|
|
|
|
|
|
|
|
|
|
| |
It was handling silly special cases with the net effect of being
nearly equivalent to just expand, while failing to expand places
which are compound macro calls. It did diagnose nonexistent place
types at expansion time, which isn't worth much.
(expand): All the expansions for the mutating operator sset, inc, dec,
push, pop and flip were also pointless and have been removed. they did
the precise equivalent of doing expand(rest(form)), and consing the
symbol to the front, which is the fallback case for function call
forms.
|
|
|
|
|
|
|
|
|
|
|
| |
means of -Werror=implicit-function-declarations. Fix broken mkdir and
mknod tests. Regenerate config.make if we add -U__STRICT_ANSI__
to the compiler options, so that later tests benefit from this.
Regenerate config.make right away if adding -D_DARWIN_C_SOURCE.
This allows the makedev test to pass.
* stream.c: Include <sys/types.h> for makedev.
(mknod_wrap): Don't rely on makedev wrappers to be there; test.
|
|
|
|
|
|
|
|
|
|
|
|
| |
not expr. expr is subject to expand_meta.
(n_expr): Do not associate source info with character
literals.
(expand_meta): Bugfix: when walking forms in a collecting loop,
propagate the source info to them. Bugfix: attach source
info to var and expr expansions.
(rl): Rewritten in terms of rlset.
(rlset): Only set source info for an object that doesn't already
have it.
|
|
|
|
|
|
| |
to the system namespace, for hygiene.
* txr.1: Updated.
|
| |
|
|
|
|
| |
return value.
|
|
|
|
| |
strict prototypes warnings; these should be errors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
mkdir and mknod.
* eval.c (eval_init): Wrap #ifdefs around the registrations of
the wrappers for these functions.
* stream.c (mkdir_wrap): Wrap in #ifdef HAVE_MKDIR, and
provide a Windows version if HAVE_MKDIR is missing, but
HAVE_WINDOWS_H is true.
(makedev_wrap, major_wrap, minor_wrap): Wrap with #if HAVE_MAKEDEV.
(mknod): Use #if HAVE_MKNOD.
(symlink_wrap, link_wrap, readlink_wrap): Wrap with #if HAVE_SYMLINK.
|
|
|
|
| |
debugger not printing the current line of data.
|
|
|
|
|
|
|
|
| |
* stream.c (symlink_wrap, link_wrap, readlink_wrap): New functions.
* stream.h (symlink_wrap, link_wrap, readlink_wrap): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Register mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap, minor_wrap,
major_wrap and mknod_wrap.
* stream.c (mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap,
minor_wrap, major_wrap, mknod_wrap): New functions.
(stream_init): Initialize forgotten variable s-ifsock.
* stream.h (s_ifsock): Declared.
(mkdir_wrap, chdir_wrap, getcwd_wrap, makedev_wrap,
minor_wrap, major_wrap, mknod_wrap): Declared.
* txr.1: Forgotten documentation for remove-path and rename-path
added. Forgotten mention of s-ifsock. Documented new Unix functions.
|
|
|
|
|
|
| |
* txr.1: Documented.
* genvim.txr, txr.vim: Updated.
|
|
|
|
|
|
| |
of Lisp forms denoted by @.
(expand_meta): Bugfix: failure to expand vars, which can be
symbol macros now.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
vector literals using their original notation.
* parser.y (unquotes_occur): Takes new argument, level.
Only finds quotes which are at the given quasiquoting level.
Finally, this is the right semantics. In the first version of this
function, we were not eager enough: we neglected to find unquotes
that were wrapped in nested quasiquotes. Then we were too eager:
finding any unquotes, even ones belonging to the inner backquotes.
(vector, hash, choose_quote): Pass zero to unquotes_occur function.
|
|
|
|
|
|
|
|
|
| |
in the dotted position: (qquote x1 .. xn . (unquote form)),
which looks like the structure (qquote x1 .. xn unquote form).
Fixed by a hack: after recursively expanding the (unquote form)
part (rest of the form), we check whether the unexpanded
version has unquote at the front. If so, we know the expansion is just
form, and use it to emit the suitable expansion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (top_smb, defsymacro_s, symacrolet_s): New global variables.
(lookup_symac, get_opt_param_syms, get_param_syms, op_defsymacro,
expand_symacrolet, make_var_shadowing_env): New static functions.
(expand_tree_cases, expand_catch_clause): Install shadowing environment
so lexical bindings hide any symbol macrolets.
(expand_place): Fix neglect to expand an atomic form, which breaks
symbol macros used as places.
(expand): Expand symbol macros, expand symacrolet binding forms.
Make sure symbol macros are shadowed in the lexical binding
constructs. Take advantage of return value of rlcp_tree in a
few places.
(macro_form_p): Support for symbol macros; bugfix: not handling
default argument.
(macroexpand_1): Streamlined, and support added for symbol macros.
(eval_init): Protect top_smb from gc. Create new hash, stored in
top_smb. Initialize defsymacro_s and symacrolet_s.
Register op_defsymacro.
* parser.y (rlcp_tree): Return the to form instead of useless t and nil.
* txr.1: Documented.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
a much more useful return value: the binding cell itself,
rather than the symbol.
(bind_args): Bugfix: env_vbind was still being called in one case,
leading to a neglect to bind a special variable properly.
(bindings_helper): Changed interface. Bugfix: in sequential binding,
actually bind the successive environments so closures will behave
100% correctly. Returns a list of the actual bindings, in which
special variables are not distinguished in any way.
(op_let, op_for): Conform to new bindings_helper interface. Use the
lexical environment that it returns instead of making a new one.
(op_each): Use the environment and list of bindings out of
bindings_helper. The bindings are used for stepping the lists,
and that includes stepping any special vars. The lexical environment
is used for evaluating the body. Thus, we need no special processing
for special vars here any more.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
rather than just assign to them. Got rid of the superfluous variable
saving array. Fixed the problem in recognizing the special_s symbol (it
is bindable).
(op_with_saved_vars): This simplifies, since it no longer needs
to save individual variables in an array, only to set up and
tear down a new dynamic environment frame.
(expand_vars): No longer returns two values with a cons.
Takes a form argument for error reporting and a pointer to a boolean
just to report whether there are special vars without listing them.
(expand_save_specials): The with-saved-specials form doesn't need
a var list any more, so the expander is updated not to stick them in.
(expand): Update calls to expand_vars to new interface.
|
|
|
|
| |
stream is not a string stream, but throw a proper error exception.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
parameter lists.
There is a bugfix here too (see eval_init below).
* eval.c (special_s): New global variable. This symbol is used
as a marker in parameter lists denoting expander-generating
syntax that gives information about specials.
(lookup_var, looup_var_l): Bugfix: walk the dynamic chain properly.
Fallback from the lexical chain to the dynamic.
(env_vbind_special): New static function.
(bind_args, bind_macro_params): Detect special list in params. Use
env_vbind_special to bind variables either in the dynamic environment
or the lexical one.
(expand_opt_params, expand_params): Renamed to expand_opt_params_rec
and expand_params_rec, respectively. Now take extra argument for
accumulating list of special variables found in the param list.
(expand_params): New static function.
(set_dyn_env): New static function.
(interp_fun, expand_macro): Set up and tear down new dynamic
environment around parameter list evaluation and body evaluation. This
will take any new dynamic bindings.
(bindings_helper, op_each): The special_s symbol is now used instead of
colon_k for marking specials.
(op_defun): Recognize the specials added to the parameter list
so as not to t report that as not a bindable symbol.
(op_catch): Set up an tear down new dynamic environment around
the evaluation of the catch clause param binding and body.
(expand_vars): use colon_s symbol instead of colon_k for marking
special var.
(eval_init): Bugfix: gc-protect recently added dyn_env variable.
Intern special symbol into special_s variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Saving and restoring of individual variables is very silly
and it's making it difficult to implement function parameters
that are rebindings of special variables.
Let's have a global pointer to a dynamic environment called dyn_env.
Let's make it part of the extended_jmp_buf structure, so that it's
implicitly saved and restored across exception handling.
Special variable lookups go through the dyn_env chain, and fall back on
the global bindings.
To override some specials, we just push a new dynamic environment and
stick them there. (As a bonus, the bindings can even be repeated in the
lexical environment (i.e. the same objects), so they can be found
faster. We have to make sure we remove that environment when we
leave the scope in the normal way. If we unwind out, it is done
automatically by extended_longjmp mechanism.
* eval.c (dyn_env): New global variable.
(lookup_var, lookup_var_l): If env is nil, look in the dyn_env
first, and only if that fails, look in the global bindings top_vb.
* signal.h (extended_jmp_buf): New member, de, for saving/restoring
dyn_env. This structure is now used whether or not we have signals.
(extended_setjmp, extended_longjmp): Updated to save and restore
dyn_env, and to do it regardless of whether there is POSIX signal
support.
(dyn_env): Declared here.
|
|
|
|
|
|
|
|
|
|
|
| |
function lookup fails, and if that fails, retrieve the special
operator binding.
(fboundp): Report t if there is a global macro binding.
* txr.1: Use "global" rather than "toplevel". Added note that
the fun operator doesn't see macro bindings. Documented that
symbol-function and fboundp see global macro bindings,
and that symbol-function can retrieve a special operator binding.
|
| |
|