* module/ice-9/boot-9.scm (syntax-local-binding): New binding.
* module/ice-9/psyntax.scm: Locally define a fluid that holds the
"transformer environment". with-transformer-environment calls a
procedure with the transformer environment, or raises an error if
called outside the extent of a transformer. Bind
transformer-environment in expand-macro.
(resolve-identifier): Backport this helper from master.
(syntax-local-binding): New procedure to return binding information of
a bound identifier (a lexical, macro, a pattern variable, a displaced
lexical, a global, or some other form).
* module/ice-9/psyntax-pp.scm: Regenerate.
* doc/ref/api-macros.texi (Syntax Transformer Helpers): Add docs for
syntax-local-binding, and syntax-source, and move some other
descriptions to this new section.
* doc/ref/api-control.texi (begin): Update to distinguish between
splicing begin and sequencing begin.
* module/ice-9/psyntax.scm (expand-expr): Add a back-compatibility shim
for `(begin)'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/syntax.test: Update to run illegal (begin) test only
if we are not including deprecated features.
* module/ice-9/psyntax.scm: Rename expand-when-list to parse-when-list,
and simplify to compare literal values.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm: Rename all instances of "chi" to "expand".
Addded a hack to expand-eval-when that will be fixed later.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/compile-psyntax.scm (source): Canonicalize after
optimizing. The optimizer should be a little more clever, but
currently fix-letrec outputs some non-canonical forms.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (define-syntax-rule): Add this new helper
macro, to define a syntax-rules macro with one clause.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (syntax-case): enabled the use of a
general last cdr instead of just '() in matching with both
a ellipsis (p ...) and a last rest pattern (. q)
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/psyntax.scm (generate-temporaries): Give temporaries the
current module, so that they may be bound at the top level.
* module/ice-9/psyntax-pp.scm: Regenerate.
* libguile/expand.h:
* module/language/tree-il.scm: Rename "sequence" to "seq", and instead
of taking a list of expressions, take a head and a tail.
* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/fix-letrec.scm:
* module/language/tree-il/spec.scm:
* module/language/elisp/compile-tree-il.scm:
* module/ice-9/psyntax.scm:
* module/ice-9/psyntax-pp.scm:
* module/ice-9/eval.scm:
* libguile/memoize.h:
* libguile/memoize.c:
* libguile/expand.c:
* libguile/eval.c: Adapt to the new seq format.
* module/ice-9/psyntax.scm (free-id=?): For identifiers that are
resolved to the toplevel, check that the variables that they would
resolve to are equal, instead of simply checking that the symbolic
identifier names are equal. Allows keywords to be bound, renamed,
exported, excluded, etc.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (fx+, fx-, fx=, fx<): Given our lame lack of
an inliner, inline these manually with identifier syntax.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (with-syntax): Allow definitions in the body,
as seems to be suggested by the R6RS.
* test-suite/tests/syncase.test ("with-syntax"): Add test.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (quasiquote): Import new definition from
upstream psyntax, to allow unquote and unquote-splicing to take
multiple arguments.
(unquote, unquote-splicing): Adapt to not require a particular syntax
form.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/psyntax.scm (chi-top): When adding to the toplevel
environment at compile-time, default to undefined variables, not
variables defined to #f.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/boot-9.scm (module-add!): Add a new pre-modules version
of this function, so we can add variables the environment, not just
values.
(module-define!): Use module-add!.
* module/ice-9/psyntax.scm (syntax-violation): Use lambda* for subform
arg. Instead of using scm-error, just throw to 'syntax-error with all
we got.
* module/ice-9/psyntax-pp.scm (#{and-map*\ 37}): Regenerated.
* module/ice-9/psyntax.scm (lookup): Reflow comment.
(chi-top, syntax): Add comments about mod for lookup.
(set!): Lookup the identifier in the module attached to its syntax
object. In the (set! MACRO foo) case, after expanding the macro, chi
the resulting expression with the empty wrap, as syntax-type
does. Seems to fix the case where the expansion references
lexically-bound variables.
* module/ice-9/psyntax-pp.scm: Regenerated.
* test-suite/tests/syncase.test: Add a bunch of tests.
* module/ice-9/psyntax.scm (underscore?): New helper, like ellipsis?.
(syntax-case): Treat the _ pattern as a matches-all pattern,
disallowing it from the keyword list. Another well-thought part of the
R6RS.
($sc-dispatch): Dispatch _ patterns.
* module/ice-9/psyntax-pp.scm: Regenerated.
* test-suite/tests/syncase.test ("_ is a placeholder"): Add a test.
* module/ice-9/psyntax.scm (build-lexical-assignment)
(build-global-assignment): Maybe name the RHS.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/boot-9.scm (catch, with-throw-handler, throw): Rework to
use set! instead of define! so that we get names.
* module/ice-9/psyntax.scm (set!): Handle variable transformers; though,
they cannot produce definitions.
(make-variable-transformer): New procedure.
(identifier-syntax): Allow the R6RS form that makes variable
transformers.
* module/ice-9/psyntax-pp.scm: Regenerated.
* doc/ref/r6rs.texi (R6RS Incompatibilities): Remove letrec* item, and
add set! restriction.
* module/ice-9/psyntax.scm (chi-body): Whoops, actually render internal
definitions into a letrec* in the right order.
* module/ice-9/psyntax-pp.scm: Regenerate.
* test-suite/tests/syntax.test: Add some letrec* tests.
* module/ice-9/psyntax.scm (chi-body): Internal definitions are now
letrec* instead of letrec, following the R6RS.
* module/ice-9/psyntax-pp.scm: Regenerated.
* libguile/expand.c (expand_letrec_helper): Factor out common code.
(expand_letrec): Use expand_letrec_helper.
(expand_letrec_star): New primitive syntax: letrec*.
* libguile/memoize.c (memoize): Add memoizer support for in-order letrec
(letrec*).
* module/ice-9/psyntax.scm (build-letrec): Another arg, `in-order?'.
(chi-body): Adapt to build-letrec change. We don't yet use letrec* for
internal definitions.
(letrec): Adapt to build-letrec change.
(letrec*): New expander.
* module/ice-9/psyntax-pp.scm: Regenerated.