| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* checkman.txr (check-func): Bugfix: neglect to scan .synb
sections for two types of headings. Include accessors, methods
and structs in the check.
(check-cblk): Use @(last) rather than @(until) so closing
.cble is consumed. Otherwise the new check for dangling
.cble will report false positives.
(check-spurious): New pattern function to detect dangling
.syne and .cble.
(main loop): Include a stand-alone .synb check for
the sake of special sections like Update expander.
Include check-spurious.
|
|
|
|
|
| |
* txr.1: Fix numerous instances of bad .cble/.cblk usage
and replace one .synb/.syne with .cblk/.cble.
|
| |
|
|
|
|
|
| |
* txr.1: Use .mets in syntax block for frame, catch-frame anf
handle-frame, as well as time.
|
|
|
|
|
| |
* txr.1: Fixed spurious comma in Methods car ...
heading and no and @ in Accessors caar ...
|
|
|
|
| |
* txr.1: Fixed under symbol-value.
|
|
|
|
| |
* txr.1: .I with run-on comma after quote becomes .IR.
|
|
|
|
| |
* txr.1: Replace silly loop with idiomatic code.
|
|
|
|
| |
* txr.1: Fix .cble that should be .cblk.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* parser.y (grammar): Remove all checks which raise a syntax
error if a clause is empty. These reject some correct
situations, getting in the programmer's way.
|
|
|
|
|
|
|
| |
* eval.c (me_whilet): insert gensym if last var is missing.
Warn if init-form looks like a variable.
* txr.1: Documented by copy and paste from iflet.
|
|
|
|
|
| |
* hash.c (hash_print_op): For hash tables that have both weak
keys and weak values, print a space between the keywords.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (pm_table): New static variable.
(expand_param_macro): New static function.
(expand_params): Expand parameter list macros via
expand_param_macro.
(eval_init): gc-protect pm_table and initialize it.
Register *param-macro* variable.
* lisplib.v (pmac_set_entries, pmac_instantiate): New static
functions.
(lisplib_init): Register autoloading of pmac.tl via new
functions.
* share/txr/stdlib/pmac.tl: New file.
* txr.1: Notes under defun, lambds, flet/labels and defmacro
about the existence of parameter macros which add to
the syntax. New Parameter List Macros section.
Documented *param-macro* and define-param-expander.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that during the expansion of something like (do
inc @1), the place expansion will generate a (sys:setq @1 ...)
form which undergoes expansion before the processing which
converts @1 to a gensym. But now that throws an error during
the expansion of the sys:setq form that @1 isn't a bindable
symbol. Since warnings are suppressed during this expansion
phase, we can make it a warning.
* eval.c (not_bindable_warning): New static function.
(do_expand): For the assignment special forms,
throw a warning if the target isn't a bindable symbol,
not an error.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It turns out we have a silly problem: catch is a special
operator, which undergoes a macro-like expansion which alters
its syntax, but uses the same operator symbol.
We turn catch into a macro which expands to a sys:catch
operator.
* eval.c (sys_catch_s): New symbol variable.
(expand_catch): Function now expands sys:catch forms
without altering any syntax.
(do_expand): Check for sys:catch rather than catch.
Call expand_catch differently: it takes the form now
instead of just the arguments, so it can return the
original form if no expansion takes place.
(eval_init): Initialize sys_catch_s variable. Change
registration of op_catch to sys:catch symbol.
* lisplib.c (except_set_entries): Add catch to the
list of autoload symbols for except.tl.
* share/txr/stdlib/except.tl (catch): New macro for
transforming catch to sys:catch.
* txr.1: Reclassify catch operator as a macro.
|
|
|
|
|
| |
* eval.c (expand_catch_clause): Check added that clause sym
must be a symbol.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is that objects like `@{foo:bar} @{*xyz*}` are
printing as `@foo:bar @*xyz*` without the required braces.
This changes the meaning, as in @foo:bar which is @foo
followed by the text :bar, or creates a syntax error,
as in @*xyz*.
* lib.c (out_quasi_str): When printing a var, first convert
it to a string form by printing to a string stream. Then
if the string form consists of anything other than letters,
digits and underscores, mark it as needing braces,
in addition to the existing conditions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (lispq_setq_s, setqf_s): New symbol variables.
(op_defvarl, op_defsymacro, op_defmacro, op_setq,
op_lisp1_setq, op_setq): Drop bindability checks.
In the case of defmacro, this is already taken care
of so the check is redundant.
(do_expand): Add bindable check to defvar_s and cousins. In
the function form fallback case, check for the various
assignment operators and check their argument count and
bindability of destination symbol.
(eval_init): Initialize new symbol variables; register
corresponding special operators using variables.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix nested macro parameters not being expanded properly in all
cases. Diagnose uses of :env, :form and :whole in
function parameter lits.
* eval.c (expand_opt_params_rec, expand_params_rec): New
parametr, macro_style_p, indicating destructuring macro
parameter list is to be expanded. Restructure the cases in
expand_opt_params_rec to fix a bug: only recursively treating
a nested parameter A only when A stands alone, or without
a default form as (A), failing to do so when it is (A B ...).
Diagnose :env, :whole or :form inside a function parameter
list. Do not process recursive parameter lists for functions;
diagnose nesting as bad syntax.
(expand_params): Add macro_style_p parameter.
(expand_macrolet, expand_tree_cases): Pass t as argument to
new parameter of expand_params.
(do_expand): Pass t or nil as argument to new parameter
of expand params, based on whether expanding a macro
or function parameter list.
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the incorrect treatment of the x-p parameter in
(lambda (: (x form x-p))) when x-p is a special variable.
It is being lexically bound.
* eval.c (expand_opt_params_rec): When processing a (var
initform) pair, check for (var initform sym). Error out if
sym is not bindable. Check if it is special and if so,
push it into the list of specials.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Checking for uses of non-bindable symbols in
variable binding and argument lists is moved to
expansion time. Also checked at expansion time
are macro lambda list conventions. :env and others
must have a bindable parameter, and the optional
arg colon cannot occur twice.
* eval.c (bind_args): Remove run-time checks that are now done
at expansion time.
(not_bindable_error): New function.
(expand_opt_params_rec, expand_params_rec): Take form argument
for reporting errors. Implement more detailed checking against
non-bindable symbols, and against :env, :form and :whole
having missing or unsuitable arguments.
(expand_params): Take form argument for error reporting,
and pass to expand_params_rec.
(bind_macro_params, bindings_helper): Remove run-time checks
that are now done at expansion time.
(check_lambda_list): Function removed, because expand_params
now does the bulk of this check. We have a regression here
in that we lose the check against :env and others occurring
in a function parameter list; this has to be worked into
expand_params.
(op_defvarl, op_defsymacro, op_defmacro, op_setq,
op_lisp1_setq, op_setqf): Replace repeated code with call to
not_bindable_error. However, these should be replaced by
expansion-time checks anyway, and eventually will be.
(expand_macrolet): Pass form to expand_params.
(expand_tree_cases): Take form argument for error reporting.
Pass to expand_params.
(expand_tree_case): Pass form to expand_tree_cases.
(me_def_variable, me_mlet): Replace repeated code with call to
not_bindable_error.
(expand_vars): Do bindable symbol check here, so it doesn't
have to be done at the run time in bindings_helper.
(me_flet_labels): Don't call check_lambda_list.
Expansion of the generated lambdas will do argument
list checking.
(expand_catch_clause): Pass form to expand_params.
(do_expand): Don't call check_lambda_list. Pass form to
expand_params.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state): New
slots fw, fw-prev and fw-ranges.
(sys:awk-state rec-to-f): New logic to handle
self.fw.
(sys:awk-let): New local fw symacro.
* txr.1: Documented fw.
|
|
|
|
|
|
| |
* eval.c (optimize_qquote_form): Check for a rcons
forms. If thearguments are nothing but quoted forms,
convert to literal range.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The issue is that ^#R(,(+ 2 2) ,(+ 3 3)) produces 4..6 rather
than #R(4..6). 4..6 is, of course, the syntax (rcons 4 6)
which evaluates to a range. Here we want the range to which
it evaluates, not the syntax.
* eval.c (expand_qquote_rec): Handle the case when the
qquoted_form is a range atom: expand the from and to parts,
and generate a rcons expression. Though this seems to be
opposite to the previous paragraph, it's the right thing.
* parser.y (range): Drop the unquotes_occurs case which
produces rcons syntax. Produce a range object, always.
This is the source of the problem: a (rcons ...) expression
was produced here which was just traversed by the qquote
expander as list. It's the expander that must produce
the rcons expression.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If we compile the regex expression (compound "str*"), calling
regex-source on the compiled regex object yields "str*".
That, of course, is treated as regex character syntax if
fed back to regex-compile, and the * becomes an operator.
We want the source to be (compound "str*").
This happens because the AST optimizer reduces
(compound X) -> X.
* regex.c (regex_compile): If the optimized expression is just
a character string atom S, then for the purposes of
maintaining the source code, convert it to (compound S).
|
|
|
|
|
|
|
|
|
|
|
|
| |
Eliminate references to a "list expression". This term
specifically denotes (list ...) and not any compound
expression.
* parser.y (define_clause): Change "unterminated list
expression" to "unterminated define directive".
(output_clause): Change "unterminated list expression" to
"unterminated output directive".
(list): Change "list expression" to "expression".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In the parallel binding (let ((x s) (s 0) (y s)) ...),
both x and y must bind to the prior value of s,
not to the new value 0. We have the bug that if
s is a special variable, the initialization of y
sees the new dynamic environment which contains the
new value, so x gets the previous, y gets new.
This commit fixes it.
* eval.c (reparent_env): New static function.
(bindings_helper): Separate logic into two loops,
for sequential and parallel binding, so we don't
have to repeatedly test this condition in the loop
body, and can think separately about each case and
streamline it. Nothing new happens under sequential
binding; the behavior that is wrong for parallel
binding is right for sequential. Under parallel binding,
what we do is reset the dynamic environment to the
original one prior to each evaluation of an initform.
Then if the evaluation changes to a new dynamic
environment (a special variable is being bound),
we notice this and hook the new environment into
a local stack, changing it parent pointer. At the
end, we install this stack as the new dynamic env.
Thus each init form is evaluated in the original
dynamic env.
* tests/011/special-1.tl: New tests added.
|
|
|
|
|
| |
* tests/011/special-1.tl (with-output-to-string): macro
removed; with-out-string-stream used.
|
|
|
|
|
| |
* tests/011/special-1.txr: Renamed to
tests/011/special-1.tl and @(do ...) removed.
|
|
|
|
|
| |
* txr.1: New section comparing TXR Lisp exceptions
with CL conditions, with a contrasting example.
|
|
|
|
|
|
|
|
| |
* eval.c (me_iflet_whenlet): Allow the last binding
to be (init-form) instead of (sym init-form), for
situations in which sym is never used.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* Makefile (clean): Remove txr-win an txr-win-dbg
executables if they exist. Because of this issue,
stale txr-win executables got packaged in some
Windows installer releases.
|
|
|
|
|
|
| |
* txr.1: The List Sorting section looks as if it describes all
the support there is for sorting. Add references pointing to
sort under Sequence Manipulation.
|
|
|
|
|
| |
* txr.1: Address \*(TL not followed by whitespace in
HTML version.
|
|
|
|
|
| |
* txr.1: The "Rule 7" example is actually triggering Rule 6.
Fix comment and add a Rule 7 example.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
| |
* eval.c (do_expand): Fix outdated comment about what
forms are expanded like function calls.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This addresses a problem with the new scheme for handling
specials. If we let specials be bound in the lexical
environment and then do the swizzle into the dynamic
environment using sys:with-dyn-rebinds, that only works
correctly for parallel bindings (and thus also for lambda and
macro parameters). For sequential bindings, it exposes the
possibility that a closure is created during the sequential
binding which captures a would-be special variable while it is
still in the lexical stage. That closure can be thrown out of
there, so the sys:with-dyn-rebinds is never reached which
swizzles the variable.
The new scheme is very simple. When expanding a let, we
tranform (s init) to (s (sys:dvbind s init)) if s is a special
variable. This new sys:dvbind operator binds s to the value of
the init expression in a newly created dynamic environment,
and returns the #:unbound symbol, which is received by the
lexical s. Problem solved. The only thing remains is that the
let special operator must save and restore the dynamic
environment.
There is no need for sys:with-dyn-rebinds around the body
of a let, but we keep that mechanism and approach for handling
specials in argument lists.
* eval.c (dvbind_s): New symbol variale.
(bindings_helper): Lose the env_out argument; return the new
environment. No caller uses the returned bindings any more.
(op_let): Call bindings_helper in initializing expression of
new_env. Save the dyn_env, and restore it after evaluating
the body.
(op_dvbind): New static function.
(expand_vars): Lose the pspecials argument. Perform
the insertion of sys:dvbind.
(do_expand): Simplify the let expander: expand_vars no longer
outputs a list of specials and there is no need to insert
with_dyn_rebinds_s. Add a case for sys:dvbind: assume it
requires no expansion.
(eval_init): Intern sys:dvbind, and bind it as an operator
to the new op_dvbind function.
|
|
|
|
|
|
| |
* share/txr/stdlib/tagbody.tl (tagbody): When calling
sys:expand, env was left out due to wrong parenthesis
placement.
|
|
|
|
|
|
|
|
|
|
|
| |
The genvim.txr program iterates over package symbols
and encounters sys:unbound. It binds that to a local
variable, creating a problem due to the special hack.
Let's turn sys:unbound into a gensym.
* eval.c (eval_init): Protect unbound_s from gc.
Initialize unbound_s with an uninterned symbol
created by make_sym.
|
|
|
|
|
|
|
|
| |
* eval.c (struct bindings_helper_vars): Remove de member.
(copy_bh_env_handler): Remove copying of dynamic environment.
(bindings_helper): Remove all code dealing with de.
The sequential binding will no longer introduce a dynamic
environment.
|
|
|
|
| |
* txr.1: Describe *place-expander* variable.
|
|
|
|
|
| |
* txr.1: Document *place-update-expander*,
*place-clobber-expander* and *place-delete-expander*.
|
|
|
|
|
| |
* txr.1: with-gensyms moves from User-Defined Places
to macros.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* unwind.c (uw_find_frames_impl): New static function, made
from uw_find_frame.
(uw_find_frame): Reduced to wrapper around
uw_find_frames_impl.
(uw_find_frames): New function.
(uw_late_init): Register find-frames intrinsic.
* unwind.h (uw_find_frames): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Local macro
sys:rng generalized to support code generation for ranges that
exclude either endpoint. Local rng macro adjusted to target
this new form. Local macros rng-, -rng, and -rng- added.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Removing code which handles the special function
argument (sys:special ...) which can occur ahead
of the other arguments, indicating the names of
arguments which require special binding.
Removing code which handles (sys:special init-form var)
bindings in let/let*.
* eval.c (env_vbind_special): Function removed.
(bind_args): Do not look for special list; no such
thing occurs. Use env_vbind directly rather than
env_vbind special.
(bind_macro_params): Likewise.
(funcall_interp): Streamlined by not having to
check for presence of specials list and setting up
the dynamic environment frame for it.
(bindings_helper): Don't look for the (sys:special
initform sym) syntax among the bindings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The old way: process, at expansion time, bindings in lambda
lists and all binding constructs to find special variables
(symbols marked special). Replace these bindings with
an annotation. Then when the interpreter performs binding,
the binding helper functions process these annotations.
Also, if specials occur, wrap the construct in
sys:with-save-specials to set up the necessary dynamic
environment frame.
The new way: process, at expansion time, bindings in
lambda lists and binding constructs (which have been reduced
to just let and let*). If special variables occur, then
wrap the body in in sys:with-dyn-rebinds which re-binds
specific symbols in the dynamic namespace, copying their
value from their lexical binding. The lexical bindings are
then replaced with the value sys:unbound, which indicates that
the value should be resolved in the dynamic environment.
* eval.c (with_saved_vars_s): Symbol variable removed.
(with_dyn_rebinds_s): New symbol variable.
(lookup_var, lookup_sym_lisp1): If a lexical binding contains
the value sys:unbound, then continue the search through the
dynamic environment; ignore the remaining lexical
environments.
(expand_params_rec): Bugfix: neglected collect of
special variable in fallback case.
(expand_params): Takes body environment, and returns two
values as a cons cell. The additional return value is a body
that is either the original body, or else is wrapped with
sys:with-dyn-rebinds. Removed is the special variable
hack inserted into the syntax.
(expand_macrolet, expand_tree_cases): Adjust to new
expand_params interface.
(op_with_saved_vars): Static function removed.
(op_with_dyn_rebinds): New static function.
(expand_vars): Return list of special variables via pointer
argument, rather than just a Boolean which indicates that
specials are present. Transformation to special representation
is removed.
(expand_catch_clause): Adjust to new expand_params interface.
(expand_save_specials): Static function removed.
(do_expand): Adjust let/let* expansion to new expand_vars
interface. Generate the sys:with-dyn-rebinds wrapping around
the body. Adjust the defun, lambda and mac-param-bind
expanders to the new expand_params interface.
Recognize sys:with-dyn-rebinds and don't expand it;
all places which generate this form have to expand the
internals themselves.
(eval_init): Remove initialization of with_saved_var_s,
and its registration as an operator.
Initialize with_dyn_rebinds_s with interned symbol,
and register as operator.
|