| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
* tests/011/patmatch.tl: New weirdly failing test case. The
@(and @a @b) is important; if that term is replaced by a
simple @a, then the correct datum is bound to c.
|
|
|
|
|
| |
* txr.1: Fix the bungled dolist macro definition, as well as
the incorrect example illustrating its usage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Squeeze the constant and unreachable cases out of (and ...)
and (or ...) forms, producing a more streamlined translation.
This is the first appearance of structural pattern matching in
the compiler!
* share/txr/stdlib/compiler.tl (compiler compile): Handle and
using new expand-and function, which translates it to if
forms. Handle or via the renamed method comp-or.
(compiler comp-and-or): Renamed to comp-or, since it handles
only or. All the switching between or/and is eliminated.
The or form is first reduced using simplify-or.
We retain this function because one case in cond relies on or;
or is a useful primitive because (or a b) evaluates a only
once; whereas (if a a b) requires common-subexpression
elimination to generate the same code as (or a b).
(true-const-p, expand-and, flatten-or, reduce-or,
simplify-or): New functions.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-not-match): New function.
(compile-match): Hook in not operator.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* txr.1: Pattern Matching is new. Though it works, the
programmer-visible, documented requirements may have to be adjusted to
make it better, and it would be nice to do that without caring about
backward compatibility. In other words, the feature is currently in
"beta": it is expected to be reliable, but the syntax and semantics are
not written in stone.
|
| |
|
|
|
|
|
|
| |
* tests/011/patmatch.tl: Add match-case test.
* txr.1: Document when-match, if-match and match-case.
|
|
|
|
|
|
| |
* tests/011/patmatch.tl: New file.
* tests/011/patmatch.expected: Likewise.
|
|
|
|
|
| |
* test/012/seq.tl: New test with multiple lambda
arguments and variadic function.
|
| |
|
|
|
|
|
| |
* txr.1: Fix "the" mistyped as "he" in the new pattern matcher
documentation, as well as under call-finalizers.
|
| |
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (cmopile-parallel-match):
Rearrange the code and bind an all-vars local variable so that
in submatch-fun we have access to the set of symbols. When
compiling the @(or) operator, we use the list to null out all
the variables that don't belong to the matching pattern.
|
| |
|
| |
|
| |
|
|
|
|
| |
* txr.1: Fix << that should be <.
|
|
|
|
|
|
|
| |
* txr.1: The operator is struct not structure. Formalize the
heading as Pattern operator.
* checkman.txr: Recognize the new Pattern operator heading.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-struct-match):
Allow a pattern instead of a struct type name, in which
case the object can be of any struct type which has
the slots required by the pattern.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: New Structurl Pattern Matching major section with new
subsections.
|
|
|
|
|
|
|
| |
* lisplib.c (match_set_entries): New autoload triggers.
* share/txr/stdlib/match.tl (lambda-match, defun-match): New
macros.
|
|
|
|
|
|
|
|
| |
* lisplib.c (match_set_entries): Add match-case and if-match
autoload trigger symbols.
* share/txr/stdlib/match.tl (if-match, match-case): New
macros.
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-op-match): New function.
(compile-match): Route op operator to new function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is implemented using exactly the same code as @(or ...);
the only difference is whether the and or or operator is used
in the expression.
* share/txr/stdlib/match.tl (compiile-or-match): Renamed to
compile-or-parallel match. Some local variables are renamed to
avoid being OR-specific. The operator is extracted from the
pattern, and inserted into the guard expression. That one
insertion is the only differnce between and and or.
(compile-match): Route the or operator to the renamed
function. Rout the new and operator to it also.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-loop-match): Eliminate
repeated (op eq 'some) tests by evaluating this once into the
some-p variable. Do not wastefully generate the code that
pushes values onto accumulation lists if we are translating
the some operator; those lists are ignored. Don't generate
those accumulation variables themselves at all.
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-or-match): New function.
(compile-match): Route or operator to new function.
|
|
|
|
|
|
| |
* eval.c (maprodv, maprendv): These functions implement maprod
and maprend; the v suffix is just in the C code and must not be
part of the self name.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Observed wrong result:
(mapcar (lambda (. args) (list . args)) '#(1 2 3) '#(4 5 6))
-> #((1 4) nil nil)
Correct result:
-> #((1 4) (2 5) (3 6))
This is not specific to vector input; it's broken for
sequences of all types.
Functions affected are mapcar, mapf, mappend, mapdo,
maprod, maprend, maprodo.
* eval.c (map_common, prod_common): Because we reuse the args
structure across iterations, we must reinitialize the fill
and list members. These can be modified by the functionw which
is called. In particular, the arguments are applied, they may
be turned into a list (fill decrements to zero, and a list is
produced).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the existential quantifier to accompany @(all).
* share/txr/stdlib/match.tl (compile-loop-match): Check for
the some symbol in a few places and adjust the output.
We don't need a local binding of the patter's variables,
only the temps. The values go directly to the outer binding of
the variables which are not shadowed now. We also don't need
the nreverse logic to set the outer variables: var-exprs
is nil at the outer level. The polarity of the loop
termination test is reversed: we quit the loop on the first
match, as is the polarity of the return value: if the loop is
aborted early t is returned instead of nil.
(compile-match): Wire in the some operator.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is in anticipation of using the same function to compile
other patterns that involve iteration.
* share/txr/stdlib/match.tl (compile-all-match): Function
renamed to compile-loop-match. The successful match and loop
termination variables are renamed to different symbols.
Also, test for the usr:all* symbol explicitly rather than
all for making the test consp.
(compile-match): Follow function rename.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-all-match): We use a flag
to break out of the loop instead of (return). The loop's block is
thereby later eliminated by the compiler. For this we
re-purpose the same all-match-p-var symbol.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (match_set_entries): Ensure usr:all* is interned.
* share/txr/stdlib/match.tl (compile-all-match): When the
operator is the existing all, we must listp as a guard, not
consp, because an empty list must match vacuously by virtue of
not containing any counterexample to the pattern. For
situations when a vacuous empty match is not desired, we
support the all* alternative operator, which uses consp.
(compile-match): Wire in the all* operator.
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (compile-all-match): New function.
(compile-match): Hook it in.
|
|
|
|
|
|
|
|
|
|
| |
For instance @(oddp) instead of @(oddp x) to require an
element to satisfy oddp without capturing it to a variable.
* share/txr/stdlib/match.tl (compile-predicate-match): Make
the symbolic argument optional, defaulting to nil.
A nil symbol is already treated as pseudo-variable which
consumes an item without binding to a variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
So quick and dirty; you have to love special variables.
* share/txr/stdlib/match.tl (*match-form*): New special
variable.
(compile-var-match, compile-predicate-match,
compile-let-match): Use compile-error instead of error,
passing the value of *match-form* as the context.
(compile-match): Ditto, and eliminate unreachable case from
cond form.
(when-match): Capture form directly into special variable
using :form *match-form*.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/match.tl (match-vars): New struct.
Holds vars and expressions, and provides the method to
zipper them up into the assignments.
(match-guard, compiled-match): Inherit from match vars.
match-guard loses temps and temp-exprs. It now has
vars and var-exprs from the base and those are used
instead.
(compiled-match get-temps): Follow temps vars rename.
(compiled-match wrap-guards): Use assignments method
inherited from base instead of assignments function.
(assignments): Function removed.
(compile-struct-match, compile-vec-match,
compile-cons-structure): Follow vars temps rename in
match-guard struct.
(when-mach): Use assignments method of compiled-match instead
of assignments function.
|
|
|
|
|
|
|
|
| |
* lisplib.c (match_instantiate, match_set_entries): New static
functions.
(lisplib_init): Register autoload using new statics.
* share/txr/stdlib/match.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our build system lumps all linker options together. The
correct way is that linker flags are separated info flags and
libs. Also, we respond to the LDFLAGS variable but ignore
LDLIBS which is incorrect. Other issues are fixed.
All that is fixed here.
* Makefile (TXR_CFLAGS): Interpolate $(CFLAGS) last, so that
options coming from CFLAGS can override previous options.
(TXR_LDFLAGS): Interpolate $(LDFLAGS) last; same reason.
(TXR_LDLIBS): New variable.
(LINK_PROG): Put $(TXR_LDFLAGS) with the options, before
the -o, and put $(TXR_LDLIBS) at the end.
* configure (conf_ldlibs, platform_ldlibs): New variables.
(usage text): Document platform-ldlibs and adjust
documentation of platform-ldflags.
(gen_config_make): Generate PLATFORM_LDLIBS and CONF_LDLIBS
now needed by Makefile.
(mainline): Adjusts various recipes to use conf_ldlibs
instead of conf_ldflags, or in some cases both.
In the case of libffi where we use pkg-config, we use the
special pgk-config options to separately extract the
flags and libs. We use EXTRA_LDLIBS instead of EXTRA_LDFLAGS
in some conftest invocations, as necessary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* METALICENSE: 2020 copyrights bumped to 2021. Added note
about SHA-256 routines from Colin Percival.
* LICENSE, LICENSE-CYG, Makefile, alloca.h, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c,
chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h,
configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h,
filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lex.yy.c.shipped,
lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/copy-file.tl, share/txr/stdlib/debugger.tl,
share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.tl,
share/txr/stdlib/each-prod.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/quips.tl,
share/txr/stdlib/save-exe.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl,
share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/trace.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, time.c, time.h,
tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr,
y.tab.c.shipped: Copyright year bumped to 2021.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some constnats in vm.c are hand-duplicates of ones in
vm-param.tl. Let's put them in vmop.h instead, where they can
be generated by the genvmop.txr script.
The two new constants are anticipated for some upcoming
VM work.
* genvmop.txr: Generate the existing VM_LEV_BITS,
VM_LEV_MASK, VM_SM_LEV_BITS and VM_SM_LEV_MASK from the
Lisp constants. Also, let's add two new ones.
* vm.c (VM_LEV_BITS, VM_LEV_MASK, VM_SM_LEV_BITS,
VM_SM_LEV_MASK): Preprocessor symbols removed.
* vmop.h (VM_LEV_BITS, VM_LEV_MASK, VM_SM_LEV_BITS,
VM_SM_LEV_MASK): Preprocessor symbols generated here with
identical values.
(VM_MAX_LEV, VM_MAX_V_LEV): New constants.
|
|
|
|
|
| |
* share/txr/stdlib/quips.tl (sys:%quips%): East Van cross and
reference to urban myth regarding Sports Illustrated cover.
|
|
|
|
|
|
|
|
| |
* txr.1: The documentation section for makunbound also
erroneously lists the fmakunbound and mmakunbound functions in
the heading and syntax block. They are not documented there,
but in their own section which follows and has its own
heading, so these references to them must be removed.
|
|
|
|
| |
* share/txr/stdlib/quips.tl (sys:%quips%): Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It seems that the Brew people are running into a problem. The
configure test is detecting that "inline" can be used for
declaring inline functions, but then some functions are not
inlined, requiring an external definition.
On GNU/Linuxes, we detect "static inline", so this doesn't
reproduce.
This is likely triggered by the recent change to compile as
C99 (unless configuring in maintainer mode).
* configure: Let's revise the set of possible definitions of
INLINE that we try. Firstly, we only try "inline" if we are
compiling as C++. If that fails, all the other forms of inline
we try include "static". Let's not mess with anything involving
"extern". Like a bare "inline", it might work in the test
program but cause some sort of failure.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (progn_fun, prog1_fun, prog2_fun): New static
functions.
(eval_init): Wire progn, prog1 and prog2 function bindings
to new functions.
* txr.1: Documented.
* checkman.txr (check-func): Recognize Macro/function and
Operators/functions heading.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (prog2_s): New symbol variable.
(me_prog2): New macro expander function.
(eval_init): Initialize prog2_s variable with interned
symbol.
Register prog2 macro expander.
* txr.1: Maintain the documentation for progn and prog1,
improving the wording and adding a dialect note .
Document prog2.
|
|
|
|
|
| |
* eval.c (eval_init): Use if_s, or_s, and_s instead of
wastefully calling intern.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.c (prepare_finals): Do not move unreachable objects with
finalizers into generation 0 here.
(call_finalizers_impl): Don't test the object for being in
generation 0; that may not be true since we don't ensure that
in prepare_finals now. Instead check he reachable flag of he
finalization entry; that tells us that we are dealing with an
object that had been found unreachable. When we re-introduce
it into freshobj, we set its generation to zero. Also, don't
bother with this freshobj logic if the full_gc flag has
been set. That now includes not bothering to set object
generations to zero.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gc.c (call_finalizers_impl): Iterate over the finalizer
registrations until no more finalizers are identified,
performing additional rounds, as necessary. Thus if finalizers
register more finalizers that are eligible for processing
according to the criteria of he current phase, those are done
in the current phase.
(gc_finalize): We must now carefully set the reachable flag to
1 for a new finalization entry. This was always the right
thing to do and is logically correct: if an object is being
passed to finalize, it is necessarily reachable. Leaving the
0 initialization would do bad things now, as follows. If any
object whatsoever has a finalizer registered against it during
GC-driven finalization, its finalizer will be called. This is
bad if the object isn't garbage. Secondly, the object may be
moved into generation 0, and put into the freshobj list. This
is extremely bad if the object is reachable by generation 1
objects, which is now a wrong-way reference.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|