1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00
Commit graph

211 commits

Author SHA1 Message Date
Andy Wingo
7d02e25661 avoid gensym when making labels in psyntax
* module/ice-9/psyntax.scm (gen-label): Avoid gensym, as we don't need
  to make symbols.

* module/ice-9/psyntax-pp.scm: Regenerate.
2012-01-19 13:08:19 +01:00
Andy Wingo
9b0975f1dc add syntax-local-binding
* 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.
2012-01-19 12:38:27 +01:00
Andy Wingo
bbc2364a3e Merge commit 'cc8afa2b36'
Conflicts:
	module/ice-9/psyntax-pp.scm
	module/language/tree-il/peval.scm
2012-01-10 00:21:48 +01:00
Andy Wingo
449bf60b81 deprecate fluid-let-syntax in favor of syntax-parameterize
* module/ice-9/psyntax.scm (syntax-parameterize): Rename from
  fluid-let-syntax.

* module/ice-9/psyntax-pp.scm: Regenerate.

* module/ice-9/boot-9.scm (define-inlinable): Use syntax-parameterize
  (and define-syntax-parameter).

* module/ice-9/deprecated.scm (fluid-let-syntax): Add deprecated shim.
2012-01-06 19:36:58 +01:00
Ludovic Courtès
a3989357b3 Regenerate `psyntax-pp.scm'.
* module/ice-9/psyntax-pp.scm: Regenerate.
2012-01-05 23:10:02 +01:00
Andy Wingo
dc65d1cf5b document invalidity of (begin) as expression; add back-compat shim
* 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.
2011-12-21 20:14:59 -05:00
Andy Wingo
b2208d2e98 Merge remote-tracking branch 'origin/stable-2.0'
Conflicts:
	configure.ac
	libguile/fluids.c
	libguile/gc.c
	libguile/gc.h
	libguile/objcodes.c
	libguile/procprop.c
	libguile/vm.c
	module/ice-9/psyntax-pp.scm
	module/ice-9/psyntax.scm
2011-12-01 23:31:50 +01:00
Andy Wingo
440ac793c4 eval-when tidying up
* 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.
2011-11-16 20:15:26 +01:00
Andy Wingo
78a474558a psyntax: s/chi/expand/g
* 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.
2011-11-16 20:08:40 +01:00
Andy Wingo
0f9f51a153 regenerate psyntax-pp
* module/ice-9/psyntax-pp.scm: Regenerate.
2011-11-07 11:48:30 +01:00
Andy Wingo
148dfc2409 refactor chi-top-sequence
* module/ice-9/psyntax.scm (chi-top-sequence): Refactor slightly.
* module/ice-9/psyntax-pp.scm: Regenerate.
2011-10-28 12:14:00 +02:00
Andy Wingo
dd64fe65fd regenerate psyntax-pp
* module/ice-9/psyntax-pp.scm: Regenerate.
2011-10-28 11:41:08 +02:00
Andy Wingo
46e372ef71 regenerate psyntax-pp.scm
* module/ice-9/psyntax-pp.scm: Regenerate, now with optimizations.
2011-10-10 16:21:06 +02:00
Andy Wingo
34c5fe83c0 regenerate psyntax-pp.scm
* module/ice-9/psyntax-pp.scm: Regenerate, now with inlined letrec
  bindings.  Whee!!
2011-10-10 14:43:37 +02:00
Andy Wingo
840cf0d1e2 regenerate psyntax-pp.scm
* module/ice-9/psyntax-pp.scm: Regenerate.
2011-09-29 18:07:02 +02:00
Andy Wingo
014de9e25d generate psyntax-pp in canonical form
* 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.
2011-09-28 19:42:32 +02:00
Andy Wingo
df40b96978 regenerate psyntax-pp.scm, with optimizations
* module/ice-9/psyntax-pp.scm: Regenerate.
2011-09-28 00:13:56 +02:00
Andy Wingo
1bbe0a631c psyntax uses define-syntax-rule
* module/ice-9/psyntax.scm: Use define-syntax-rule.

* module/ice-9/psyntax-pp.scm: Regenerate.
2011-09-02 11:34:00 +02:00
Andy Wingo
dea14eb99b add define-syntax-rule
* 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.
2011-09-02 11:28:11 +02:00
Andy Wingo
26c81c7f40 Merge remote-tracking branch 'origin/lexical-literals'
Conflicts:
	module/ice-9/psyntax-pp.scm
2011-06-30 13:48:43 +02:00
Andy Wingo
8a562c697b Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
	libguile/deprecated.c
	module/ice-9/psyntax-pp.scm
2011-06-30 13:47:46 +02:00
Stefan Israelsson Tampe
0ed9680fba psyntax: enable dotted tail patterns
* 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.
2011-06-21 22:41:08 +02:00
Andy Wingo
78f0ef20a7 Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts:
	module/ice-9/psyntax-pp.scm
	module/language/tree-il/compile-glil.scm
2011-06-18 01:07:20 +02:00
Andy Wingo
25711fa4ca fix tree-il->scheme bug for seq
* module/language/tree-il.scm (tree-il->scheme): Fix bug for `seq'.

* module/ice-9/psyntax-pp.scm: Regenerate correctly.
2011-06-18 00:38:52 +02:00
Andreas Rottmann
933c6eb795 Silence warnings for variables created by `generate-temporaries'
* 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.
2011-06-17 10:43:24 +02:00
Andy Wingo
6fc3eae477 sequence of expressions -> seq of head and tail
* 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.
2011-06-02 19:13:32 +02:00
Andy Wingo
a881a4ae3b add <primcall> to tree-il
* libguile/expand.c:
* libguile/expand.h (SCM_EXPANDED_PRIMCALL_TYPE_NAME):
  (SCM_EXPANDED_PRIMCALL_FIELD_NAMES):
  (SCM_EXPANDED_PRIMCALL_SRC):
  (SCM_EXPANDED_PRIMCALL_NAME):
  (SCM_EXPANDED_PRIMCALL_ARGS):
  (SCM_MAKE_EXPANDED_PRIMCALL): Add "primcall" Tree-IL type.

* doc/ref/compiler.texi (Tree-IL): Update docs.

* libguile/memoize.c (memoize): Memoizer for primcalls.

* module/ice-9/psyntax.scm: Build primcalls, sometimes.  Also change
  build-primref to just make a primitive-ref.

* module/language/tree-il.scm: Add primcall to the exports, parsers,
  serializers, etc.

* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/fix-letrec.scm:
* module/language/tree-il/inline.scm:
* module/language/tree-il/primitives.scm:
* module/language/elisp/compile-tree-il.scm: Add primcall support.

* test-suite/tests/tree-il.test: Use primcalls sometimes.
2011-06-02 17:45:58 +02:00
Andy Wingo
7081d4f981 rename <application> to <call>
* doc/ref/compiler.texi (The Scheme Compiler): Update docs.

* libguile/expand.h:
* libguile/expand.c:
* module/language/tree-il.scm: Rename <application> to <call>.  Change
  the external representation from (apply proc arg ...) to (call proc
  arg ...).

* libguile/memoize.c:
* module/ice-9/psyntax-pp.scm:
* module/ice-9/psyntax.scm:
* module/language/brainfuck/compile-tree-il.scm:
* module/language/ecmascript/compile-tree-il.scm:
* module/language/elisp/compile-tree-il.scm:
* module/language/tree-il/analyze.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/fix-letrec.scm:
* module/language/tree-il/inline.scm:
* module/language/tree-il/primitives.scm:
* test-suite/tests/tree-il.test: Update all callers.
2011-06-02 13:42:55 +02:00
Andy Wingo
e2ccab571e psyntax simplification
* module/ice-9/psyntax.scm (strip): Inline the and-map* definition to
  its one call site.

* module/ice-9/psyntax-pp.scm: Regenerate.
2011-05-05 23:07:37 +02:00
Andy Wingo
04b04af85a fix free-id=? for module-bound keywords
* 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.
2011-04-29 16:37:42 +02:00
Andy Wingo
b9e22602bb regen psyntax-pp.scm
* module/ice-9/psyntax-pp.scm: Regenerate, to take advantage of better
  #{}# serialization.
2011-04-11 13:49:29 +02:00
Andy Wingo
d8f699e8eb inline fxops in psyntax
* 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.
2011-03-31 13:29:58 +02:00
Andy Wingo
f929b9e5ec allow definitions in with-syntax body
* 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.
2011-03-31 13:23:27 +02:00
Andy Wingo
4335366389 regenerate psyntax-pp
* module/ice-9/psyntax-pp.scm: Regenerate.
2011-02-27 12:59:44 +01:00
Andy Wingo
0f550375be unquote and unquote-splicing can split multiple expressions
* 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.
2011-02-08 21:38:57 +01:00
Andy Wingo
05a5e5d6d0 toplevel vars added by syntax expansion are unbound
* 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!.
2011-01-31 21:09:20 +01:00
Andy Wingo
8f1870f20f syntax-violation uses lambda*, throws a structured message
* 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.
2010-11-16 02:56:57 +01:00
Andy Wingo
381ccb0b89 more inlining in psyntax
* module/ice-9/psyntax.scm (make-wrap, wrap-marks, wrap-subst): Use
  identifier syntax here too.

* module/ice-9/psyntax-pp.scm: Regenerated.
2010-10-08 12:31:56 +02:00
Andy Wingo
d8e4f9e509 regenerate psyntax-pp.scm
* module/ice-9/psyntax-pp.scm: Regenerate.
2010-09-10 11:03:59 +02:00
Andy Wingo
565c8e30cd update comments in psyntax.scm
* module/ice-9/psyntax.scm: Update comments. Fix a couple of needless
  conses in and-map.

* module/ice-9/psyntax-pp.scm (#{and-map*\ 35}): Regen.
2010-08-16 21:36:14 -07:00
Andy Wingo
ab6becd47f fix (set! MACRO exp) hygiene
* 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.
2010-07-09 17:05:02 +02:00
Andy Wingo
7cdd1615e0 relax restriction on _ in literals
* module/ice-9/psyntax.scm: Relax restriction on _ in literals.

* module/ice-9/psyntax-pp.scm: Regen.
2010-06-21 21:47:42 +02:00
Andy Wingo
b78d91d517 syntax-case treats _ as placeholder
* 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.
2010-06-21 20:56:05 +02:00
Andy Wingo
77b79cce0c freshly regenerate psyntax-pp
* module/ice-9/psyntax-pp.scm: A fresh regen to get the lowest gensyms
  we can. Needs a better solution in the end.
2010-06-21 11:02:00 +02:00
Andy Wingo
37620f3f4e set! name (lambda ...) names the lambda
* 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.
2010-06-19 13:56:16 +02:00
Andy Wingo
bfccdcd530 add support for variable transformers: settable identifier syntax
* 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.
2010-06-19 12:43:40 +02:00
Andy Wingo
5f8c55ce3b fix order of internal definitions
* 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.
2010-06-17 14:39:32 +02:00
Andy Wingo
417ee09802 compile-psyntax "optimizes" psyntax-pp
* module/ice-9/compile-psyntax.scm (source): "Optimize" psyntax-pp
  before writing it out.

* module/ice-9/psyntax-pp.scm: Regenerated.
2010-06-17 13:43:27 +02:00
Andy Wingo
0f2b9f6252 internal definitions expand out to letrec* instead of letrec
* 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.
2010-06-17 13:43:26 +02:00
Andy Wingo
826373a25d psyntax, primitive expander, and memoizer support for letrec*
* 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.
2010-06-17 13:43:26 +02:00