LilyPond-Ruby 0.0.2.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/etc/fonts/conf.d/10-hinting-slight.conf +15 -0
- data/etc/fonts/conf.d/10-scale-bitmap-fonts.conf +83 -0
- data/etc/fonts/conf.d/11-lcdfilter-default.conf +17 -0
- data/etc/fonts/conf.d/20-unhint-small-vera.conf +49 -0
- data/etc/fonts/conf.d/30-metric-aliases.conf +637 -0
- data/etc/fonts/conf.d/40-nonlatin.conf +332 -0
- data/etc/fonts/conf.d/45-generic.conf +136 -0
- data/etc/fonts/conf.d/45-latin.conf +301 -0
- data/etc/fonts/conf.d/48-spacing.conf +16 -0
- data/etc/fonts/conf.d/49-sansserif.conf +22 -0
- data/etc/fonts/conf.d/50-user.conf +16 -0
- data/etc/fonts/conf.d/51-local.conf +7 -0
- data/etc/fonts/conf.d/60-generic.conf +64 -0
- data/etc/fonts/conf.d/60-latin.conf +88 -0
- data/etc/fonts/conf.d/65-fonts-persian.conf +418 -0
- data/etc/fonts/conf.d/65-nonlatin.conf +228 -0
- data/etc/fonts/conf.d/69-unifont.conf +28 -0
- data/etc/fonts/conf.d/80-delicious.conf +19 -0
- data/etc/fonts/conf.d/90-synthetic.conf +64 -0
- data/etc/fonts/conf.d/README +23 -0
- data/etc/fonts/fonts.conf +101 -0
- data/etc/relocate/fontconfig.reloc +2 -0
- data/etc/relocate/guile.reloc +2 -0
- data/etc/relocate/libexec.reloc +1 -0
- data/lib/guile/2.2/ccache/ice-9/and-let-star.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/arrays.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/atomic.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/binary-ports.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/boot-9.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/buffered-input.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/calling.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/channel.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/command-line.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/common-list.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/control.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/curried-definitions.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/debug.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/deprecated.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/documentation.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/eval-string.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/eval.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/expect.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/fdes-finalizers.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/format.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/ftw.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/futures.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/gap-buffer.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/getopt-long.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/hash-table.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/hcons.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/history.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/i18n.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/iconv.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/lineio.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/list.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/local-eval.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/ls.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/mapping.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/match.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/networking.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/null.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/occam-channel.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/optargs.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/peg/cache.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/peg/codegen.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/peg/simplify-tree.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/peg/string-peg.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/peg/using-parsers.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/peg.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/poe.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/poll.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/popen.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/ports.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/posix.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/pretty-print.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/psyntax-pp.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/q.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/r5rs.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/rdelim.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/receive.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/regex.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/runq.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/rw.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/safe-r5rs.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/safe.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/sandbox.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/save-stack.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/scm-style-repl.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/serialize.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/session.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/slib.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/stack-catch.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/streams.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/string-fun.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/suspendable-ports.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/syncase.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/textual-ports.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/threads.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/time.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/top-repl.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/unicode.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/vlist.go +0 -0
- data/lib/guile/2.2/ccache/ice-9/weak-vector.go +0 -0
- data/lib/guile/2.2/ccache/language/brainfuck/compile-scheme.go +0 -0
- data/lib/guile/2.2/ccache/language/brainfuck/compile-tree-il.go +0 -0
- data/lib/guile/2.2/ccache/language/brainfuck/parse.go +0 -0
- data/lib/guile/2.2/ccache/language/brainfuck/spec.go +0 -0
- data/lib/guile/2.2/ccache/language/bytecode/spec.go +0 -0
- data/lib/guile/2.2/ccache/language/bytecode.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/closure-conversion.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/compile-bytecode.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/constructors.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/contification.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/cse.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/dce.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/effects-analysis.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/elide-values.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/handle-interrupts.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/intmap.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/intset.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/licm.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/optimize.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/peel-loops.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/primitives.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/prune-bailouts.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/prune-top-level-scopes.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/reify-primitives.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/renumber.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/rotate-loops.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/self-references.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/simplify.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/slot-allocation.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/spec.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/specialize-numbers.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/specialize-primcalls.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/split-rec.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/type-checks.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/type-fold.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/types.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/utils.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/verify.go +0 -0
- data/lib/guile/2.2/ccache/language/cps/with-cps.go +0 -0
- data/lib/guile/2.2/ccache/language/cps.go +0 -0
- data/lib/guile/2.2/ccache/language/ecmascript/array.go +0 -0
- data/lib/guile/2.2/ccache/language/ecmascript/base.go +0 -0
- data/lib/guile/2.2/ccache/language/ecmascript/compile-tree-il.go +0 -0
- data/lib/guile/2.2/ccache/language/ecmascript/function.go +0 -0
- data/lib/guile/2.2/ccache/language/ecmascript/impl.go +0 -0
- data/lib/guile/2.2/ccache/language/ecmascript/parse.go +0 -0
- data/lib/guile/2.2/ccache/language/ecmascript/spec.go +0 -0
- data/lib/guile/2.2/ccache/language/ecmascript/tokenize.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/bindings.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/boot.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/compile-tree-il.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/falias.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/lexer.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/parser.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/runtime/function-slot.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/runtime/value-slot.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/runtime.go +0 -0
- data/lib/guile/2.2/ccache/language/elisp/spec.go +0 -0
- data/lib/guile/2.2/ccache/language/scheme/compile-tree-il.go +0 -0
- data/lib/guile/2.2/ccache/language/scheme/decompile-tree-il.go +0 -0
- data/lib/guile/2.2/ccache/language/scheme/spec.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/analyze.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/canonicalize.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/compile-cps.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/debug.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/effects.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/fix-letrec.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/optimize.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/peval.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/primitives.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il/spec.go +0 -0
- data/lib/guile/2.2/ccache/language/tree-il.go +0 -0
- data/lib/guile/2.2/ccache/language/value/spec.go +0 -0
- data/lib/guile/2.2/ccache/oop/goops/accessors.go +0 -0
- data/lib/guile/2.2/ccache/oop/goops/active-slot.go +0 -0
- data/lib/guile/2.2/ccache/oop/goops/composite-slot.go +0 -0
- data/lib/guile/2.2/ccache/oop/goops/describe.go +0 -0
- data/lib/guile/2.2/ccache/oop/goops/internal.go +0 -0
- data/lib/guile/2.2/ccache/oop/goops/save.go +0 -0
- data/lib/guile/2.2/ccache/oop/goops/simple.go +0 -0
- data/lib/guile/2.2/ccache/oop/goops/stklos.go +0 -0
- data/lib/guile/2.2/ccache/oop/goops.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/arithmetic/bitwise.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/arithmetic/fixnums.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/arithmetic/flonums.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/base.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/bytevectors.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/conditions.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/control.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/enums.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/eval.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/exceptions.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/files.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/hashtables.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/io/ports.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/io/simple.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/lists.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/mutable-pairs.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/mutable-strings.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/programs.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/r5rs.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/records/inspection.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/records/procedural.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/records/syntactic.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/sorting.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/syntax-case.go +0 -0
- data/lib/guile/2.2/ccache/rnrs/unicode.go +0 -0
- data/lib/guile/2.2/ccache/rnrs.go +0 -0
- data/lib/guile/2.2/ccache/scripts/api-diff.go +0 -0
- data/lib/guile/2.2/ccache/scripts/autofrisk.go +0 -0
- data/lib/guile/2.2/ccache/scripts/compile.go +0 -0
- data/lib/guile/2.2/ccache/scripts/disassemble.go +0 -0
- data/lib/guile/2.2/ccache/scripts/display-commentary.go +0 -0
- data/lib/guile/2.2/ccache/scripts/doc-snarf.go +0 -0
- data/lib/guile/2.2/ccache/scripts/frisk.go +0 -0
- data/lib/guile/2.2/ccache/scripts/generate-autoload.go +0 -0
- data/lib/guile/2.2/ccache/scripts/help.go +0 -0
- data/lib/guile/2.2/ccache/scripts/lint.go +0 -0
- data/lib/guile/2.2/ccache/scripts/list.go +0 -0
- data/lib/guile/2.2/ccache/scripts/punify.go +0 -0
- data/lib/guile/2.2/ccache/scripts/read-rfc822.go +0 -0
- data/lib/guile/2.2/ccache/scripts/read-scheme-source.go +0 -0
- data/lib/guile/2.2/ccache/scripts/read-text-outline.go +0 -0
- data/lib/guile/2.2/ccache/scripts/scan-api.go +0 -0
- data/lib/guile/2.2/ccache/scripts/snarf-check-and-output-texi.go +0 -0
- data/lib/guile/2.2/ccache/scripts/snarf-guile-m4-docs.go +0 -0
- data/lib/guile/2.2/ccache/scripts/summarize-guile-TODO.go +0 -0
- data/lib/guile/2.2/ccache/scripts/use2dot.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-1.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-10.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-11.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-111.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-13.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-14.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-16.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-17.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-18.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-19.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-2.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-26.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-27.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-28.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-31.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-34.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-35.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-37.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-38.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-39.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-4/gnu.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-4.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-41.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-42.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-43.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-45.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-6.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-60.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-64.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-67.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-69.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-71.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-8.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-88.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-9/gnu.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-9.go +0 -0
- data/lib/guile/2.2/ccache/srfi/srfi-98.go +0 -0
- data/lib/guile/2.2/ccache/statprof.go +0 -0
- data/lib/guile/2.2/ccache/sxml/apply-templates.go +0 -0
- data/lib/guile/2.2/ccache/sxml/fold.go +0 -0
- data/lib/guile/2.2/ccache/sxml/match.go +0 -0
- data/lib/guile/2.2/ccache/sxml/simple.go +0 -0
- data/lib/guile/2.2/ccache/sxml/ssax/input-parse.go +0 -0
- data/lib/guile/2.2/ccache/sxml/ssax.go +0 -0
- data/lib/guile/2.2/ccache/sxml/transform.go +0 -0
- data/lib/guile/2.2/ccache/sxml/xpath.go +0 -0
- data/lib/guile/2.2/ccache/system/base/ck.go +0 -0
- data/lib/guile/2.2/ccache/system/base/compile.go +0 -0
- data/lib/guile/2.2/ccache/system/base/lalr.go +0 -0
- data/lib/guile/2.2/ccache/system/base/language.go +0 -0
- data/lib/guile/2.2/ccache/system/base/message.go +0 -0
- data/lib/guile/2.2/ccache/system/base/pmatch.go +0 -0
- data/lib/guile/2.2/ccache/system/base/syntax.go +0 -0
- data/lib/guile/2.2/ccache/system/base/target.go +0 -0
- data/lib/guile/2.2/ccache/system/base/types.go +0 -0
- data/lib/guile/2.2/ccache/system/foreign-object.go +0 -0
- data/lib/guile/2.2/ccache/system/foreign.go +0 -0
- data/lib/guile/2.2/ccache/system/repl/command.go +0 -0
- data/lib/guile/2.2/ccache/system/repl/common.go +0 -0
- data/lib/guile/2.2/ccache/system/repl/coop-server.go +0 -0
- data/lib/guile/2.2/ccache/system/repl/debug.go +0 -0
- data/lib/guile/2.2/ccache/system/repl/error-handling.go +0 -0
- data/lib/guile/2.2/ccache/system/repl/repl.go +0 -0
- data/lib/guile/2.2/ccache/system/repl/server.go +0 -0
- data/lib/guile/2.2/ccache/system/syntax.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/assembler.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/coverage.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/debug.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/disassembler.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/dwarf.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/elf.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/frame.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/inspect.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/linker.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/loader.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/program.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/trace.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/trap-state.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/traps.go +0 -0
- data/lib/guile/2.2/ccache/system/vm/vm.go +0 -0
- data/lib/guile/2.2/ccache/system/xref.go +0 -0
- data/lib/guile/2.2/ccache/texinfo/docbook.go +0 -0
- data/lib/guile/2.2/ccache/texinfo/html.go +0 -0
- data/lib/guile/2.2/ccache/texinfo/indexing.go +0 -0
- data/lib/guile/2.2/ccache/texinfo/plain-text.go +0 -0
- data/lib/guile/2.2/ccache/texinfo/reflection.go +0 -0
- data/lib/guile/2.2/ccache/texinfo/serialize.go +0 -0
- data/lib/guile/2.2/ccache/texinfo/string-utils.go +0 -0
- data/lib/guile/2.2/ccache/texinfo.go +0 -0
- data/lib/guile/2.2/ccache/web/client.go +0 -0
- data/lib/guile/2.2/ccache/web/http.go +0 -0
- data/lib/guile/2.2/ccache/web/request.go +0 -0
- data/lib/guile/2.2/ccache/web/response.go +0 -0
- data/lib/guile/2.2/ccache/web/server/http.go +0 -0
- data/lib/guile/2.2/ccache/web/server.go +0 -0
- data/lib/guile/2.2/ccache/web/uri.go +0 -0
- data/lib/guile.rb +19 -0
- data/lib/lilypond/2.24.1/ccache/lily/accreg.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/auto-beam.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/autochange.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/backend-library.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/bar-line.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/breath.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/c++.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/chord-entry.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/chord-ignatzek-names.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/chord-name.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/clip-region.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/color.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/curried-definitions.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-context-properties.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-event-classes.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-grob-interfaces.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-grob-properties.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-grobs.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-markup-commands.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-music-callbacks.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-music-display-methods.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-music-properties.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-music-types.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-note-names.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-stencil-commands.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/define-woodwind-diagrams.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/display-lily.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/display-woodwind-diagrams.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/file-cache.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/flag-styles.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/font-encodings.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/font.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/framework-cairo.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/framework-ps.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/framework-svg.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/fret-diagrams.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/graphviz.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/harp-pedals.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/layout-beam.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/layout-slur.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/lily-library.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/lily.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/ly-syntax-constructors.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/markup-macros.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/markup.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/midi.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/modal-transforms.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/music-functions.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/output-lib.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/output-ps.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/output-svg.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/page.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/paper-system.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/paper.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/parser-clef.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/parser-ly-from-scheme.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/part-combiner.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/predefined-fretboards.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/ps-to-png.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/scheme-engravers.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/scheme-performers.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/script.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/skyline.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/song-util.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/song.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/stencil.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/tablature.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/time-signature-settings.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/time-signature.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/titling.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/to-xml.go +0 -0
- data/lib/lilypond/2.24.1/ccache/lily/translation-functions.go +0 -0
- data/lib/lilypond/builder.rb +161 -0
- data/lib/lilypond-ruby.rb +18 -3
- data/share/emacs/site-lisp/lilypond-font-lock.el +208 -0
- data/share/emacs/site-lisp/lilypond-indent.el +605 -0
- data/share/emacs/site-lisp/lilypond-init.el +21 -0
- data/share/emacs/site-lisp/lilypond-mode.el +1204 -0
- data/share/emacs/site-lisp/lilypond-song.el +556 -0
- data/share/emacs/site-lisp/lilypond-what-beat.el +279 -0
- data/share/emacs/site-lisp/lilypond-words.el +1428 -0
- data/share/guile/2.2/guile-procedures.txt +8860 -0
- data/share/guile/2.2/ice-9/and-let-star.scm +73 -0
- data/share/guile/2.2/ice-9/arrays.scm +70 -0
- data/share/guile/2.2/ice-9/atomic.scm +38 -0
- data/share/guile/2.2/ice-9/binary-ports.scm +53 -0
- data/share/guile/2.2/ice-9/boot-9.scm +4131 -0
- data/share/guile/2.2/ice-9/buffered-input.scm +109 -0
- data/share/guile/2.2/ice-9/calling.scm +326 -0
- data/share/guile/2.2/ice-9/channel.scm +170 -0
- data/share/guile/2.2/ice-9/command-line.scm +477 -0
- data/share/guile/2.2/ice-9/common-list.scm +278 -0
- data/share/guile/2.2/ice-9/control.scm +110 -0
- data/share/guile/2.2/ice-9/curried-definitions.scm +57 -0
- data/share/guile/2.2/ice-9/debug.scm +25 -0
- data/share/guile/2.2/ice-9/deprecated.scm +93 -0
- data/share/guile/2.2/ice-9/documentation.scm +203 -0
- data/share/guile/2.2/ice-9/eval-string.scm +90 -0
- data/share/guile/2.2/ice-9/eval.scm +723 -0
- data/share/guile/2.2/ice-9/expect.scm +171 -0
- data/share/guile/2.2/ice-9/fdes-finalizers.scm +25 -0
- data/share/guile/2.2/ice-9/format.scm +1626 -0
- data/share/guile/2.2/ice-9/ftw.scm +564 -0
- data/share/guile/2.2/ice-9/futures.scm +308 -0
- data/share/guile/2.2/ice-9/gap-buffer.scm +283 -0
- data/share/guile/2.2/ice-9/getopt-long.scm +371 -0
- data/share/guile/2.2/ice-9/hash-table.scm +45 -0
- data/share/guile/2.2/ice-9/hcons.scm +80 -0
- data/share/guile/2.2/ice-9/history.scm +65 -0
- data/share/guile/2.2/ice-9/i18n.scm +531 -0
- data/share/guile/2.2/ice-9/iconv.scm +95 -0
- data/share/guile/2.2/ice-9/lineio.scm +115 -0
- data/share/guile/2.2/ice-9/list.scm +36 -0
- data/share/guile/2.2/ice-9/local-eval.scm +261 -0
- data/share/guile/2.2/ice-9/ls.scm +94 -0
- data/share/guile/2.2/ice-9/mapping.scm +118 -0
- data/share/guile/2.2/ice-9/match.scm +59 -0
- data/share/guile/2.2/ice-9/match.upstream.scm +917 -0
- data/share/guile/2.2/ice-9/networking.scm +94 -0
- data/share/guile/2.2/ice-9/null.scm +34 -0
- data/share/guile/2.2/ice-9/occam-channel.scm +261 -0
- data/share/guile/2.2/ice-9/optargs.scm +381 -0
- data/share/guile/2.2/ice-9/peg/cache.scm +45 -0
- data/share/guile/2.2/ice-9/peg/codegen.scm +359 -0
- data/share/guile/2.2/ice-9/peg/simplify-tree.scm +97 -0
- data/share/guile/2.2/ice-9/peg/string-peg.scm +273 -0
- data/share/guile/2.2/ice-9/peg/using-parsers.scm +116 -0
- data/share/guile/2.2/ice-9/peg.scm +42 -0
- data/share/guile/2.2/ice-9/poe.scm +116 -0
- data/share/guile/2.2/ice-9/poll.scm +172 -0
- data/share/guile/2.2/ice-9/popen.scm +178 -0
- data/share/guile/2.2/ice-9/ports.scm +566 -0
- data/share/guile/2.2/ice-9/posix.scm +75 -0
- data/share/guile/2.2/ice-9/pretty-print.scm +483 -0
- data/share/guile/2.2/ice-9/psyntax-pp.scm +3542 -0
- data/share/guile/2.2/ice-9/psyntax.scm +3326 -0
- data/share/guile/2.2/ice-9/q.scm +153 -0
- data/share/guile/2.2/ice-9/quasisyntax.scm +136 -0
- data/share/guile/2.2/ice-9/r5rs.scm +45 -0
- data/share/guile/2.2/ice-9/r6rs-libraries.scm +242 -0
- data/share/guile/2.2/ice-9/rdelim.scm +208 -0
- data/share/guile/2.2/ice-9/receive.scm +26 -0
- data/share/guile/2.2/ice-9/regex.scm +229 -0
- data/share/guile/2.2/ice-9/runq.scm +241 -0
- data/share/guile/2.2/ice-9/rw.scm +27 -0
- data/share/guile/2.2/ice-9/safe-r5rs.scm +145 -0
- data/share/guile/2.2/ice-9/safe.scm +34 -0
- data/share/guile/2.2/ice-9/sandbox.scm +1399 -0
- data/share/guile/2.2/ice-9/save-stack.scm +58 -0
- data/share/guile/2.2/ice-9/scm-style-repl.scm +279 -0
- data/share/guile/2.2/ice-9/serialize.scm +114 -0
- data/share/guile/2.2/ice-9/session.scm +530 -0
- data/share/guile/2.2/ice-9/slib.scm +33 -0
- data/share/guile/2.2/ice-9/stack-catch.scm +47 -0
- data/share/guile/2.2/ice-9/streams.scm +168 -0
- data/share/guile/2.2/ice-9/string-fun.scm +280 -0
- data/share/guile/2.2/ice-9/suspendable-ports.scm +788 -0
- data/share/guile/2.2/ice-9/syncase.scm +37 -0
- data/share/guile/2.2/ice-9/textual-ports.scm +70 -0
- data/share/guile/2.2/ice-9/threads.scm +392 -0
- data/share/guile/2.2/ice-9/time.scm +58 -0
- data/share/guile/2.2/ice-9/top-repl.scm +78 -0
- data/share/guile/2.2/ice-9/unicode.scm +26 -0
- data/share/guile/2.2/ice-9/vlist.scm +595 -0
- data/share/guile/2.2/ice-9/weak-vector.scm +31 -0
- data/share/guile/2.2/language/brainfuck/compile-scheme.scm +123 -0
- data/share/guile/2.2/language/brainfuck/compile-tree-il.scm +184 -0
- data/share/guile/2.2/language/brainfuck/parse.scm +95 -0
- data/share/guile/2.2/language/brainfuck/spec.scm +43 -0
- data/share/guile/2.2/language/bytecode/spec.scm +42 -0
- data/share/guile/2.2/language/bytecode.scm +104 -0
- data/share/guile/2.2/language/cps/closure-conversion.scm +848 -0
- data/share/guile/2.2/language/cps/compile-bytecode.scm +610 -0
- data/share/guile/2.2/language/cps/constructors.scm +106 -0
- data/share/guile/2.2/language/cps/contification.scm +448 -0
- data/share/guile/2.2/language/cps/cse.scm +414 -0
- data/share/guile/2.2/language/cps/dce.scm +363 -0
- data/share/guile/2.2/language/cps/effects-analysis.scm +597 -0
- data/share/guile/2.2/language/cps/elide-values.scm +88 -0
- data/share/guile/2.2/language/cps/handle-interrupts.scm +69 -0
- data/share/guile/2.2/language/cps/intmap.scm +765 -0
- data/share/guile/2.2/language/cps/intset.scm +830 -0
- data/share/guile/2.2/language/cps/licm.scm +308 -0
- data/share/guile/2.2/language/cps/optimize.scm +135 -0
- data/share/guile/2.2/language/cps/peel-loops.scm +287 -0
- data/share/guile/2.2/language/cps/primitives.scm +141 -0
- data/share/guile/2.2/language/cps/prune-bailouts.scm +86 -0
- data/share/guile/2.2/language/cps/prune-top-level-scopes.scm +63 -0
- data/share/guile/2.2/language/cps/reify-primitives.scm +179 -0
- data/share/guile/2.2/language/cps/renumber.scm +217 -0
- data/share/guile/2.2/language/cps/rotate-loops.scm +239 -0
- data/share/guile/2.2/language/cps/self-references.scm +79 -0
- data/share/guile/2.2/language/cps/simplify.scm +274 -0
- data/share/guile/2.2/language/cps/slot-allocation.scm +1058 -0
- data/share/guile/2.2/language/cps/spec.scm +51 -0
- data/share/guile/2.2/language/cps/specialize-numbers.scm +724 -0
- data/share/guile/2.2/language/cps/specialize-primcalls.scm +87 -0
- data/share/guile/2.2/language/cps/split-rec.scm +174 -0
- data/share/guile/2.2/language/cps/type-checks.scm +72 -0
- data/share/guile/2.2/language/cps/type-fold.scm +455 -0
- data/share/guile/2.2/language/cps/types.scm +1826 -0
- data/share/guile/2.2/language/cps/utils.scm +550 -0
- data/share/guile/2.2/language/cps/verify.scm +304 -0
- data/share/guile/2.2/language/cps/with-cps.scm +145 -0
- data/share/guile/2.2/language/cps.scm +358 -0
- data/share/guile/2.2/language/ecmascript/array.scm +121 -0
- data/share/guile/2.2/language/ecmascript/base.scm +251 -0
- data/share/guile/2.2/language/ecmascript/compile-tree-il.scm +576 -0
- data/share/guile/2.2/language/ecmascript/function.scm +78 -0
- data/share/guile/2.2/language/ecmascript/impl.scm +169 -0
- data/share/guile/2.2/language/ecmascript/parse.scm +352 -0
- data/share/guile/2.2/language/ecmascript/spec.scm +37 -0
- data/share/guile/2.2/language/ecmascript/tokenize.scm +513 -0
- data/share/guile/2.2/language/elisp/bindings.scm +107 -0
- data/share/guile/2.2/language/elisp/boot.el +617 -0
- data/share/guile/2.2/language/elisp/compile-tree-il.scm +812 -0
- data/share/guile/2.2/language/elisp/falias.scm +47 -0
- data/share/guile/2.2/language/elisp/lexer.scm +430 -0
- data/share/guile/2.2/language/elisp/parser.scm +222 -0
- data/share/guile/2.2/language/elisp/runtime/function-slot.scm +63 -0
- data/share/guile/2.2/language/elisp/runtime/value-slot.scm +24 -0
- data/share/guile/2.2/language/elisp/runtime.scm +153 -0
- data/share/guile/2.2/language/elisp/spec.scm +43 -0
- data/share/guile/2.2/language/scheme/compile-tree-il.scm +33 -0
- data/share/guile/2.2/language/scheme/decompile-tree-il.scm +796 -0
- data/share/guile/2.2/language/scheme/spec.scm +63 -0
- data/share/guile/2.2/language/tree-il/analyze.scm +1568 -0
- data/share/guile/2.2/language/tree-il/canonicalize.scm +82 -0
- data/share/guile/2.2/language/tree-il/compile-cps.scm +1149 -0
- data/share/guile/2.2/language/tree-il/debug.scm +246 -0
- data/share/guile/2.2/language/tree-il/effects.scm +591 -0
- data/share/guile/2.2/language/tree-il/fix-letrec.scm +314 -0
- data/share/guile/2.2/language/tree-il/optimize.scm +43 -0
- data/share/guile/2.2/language/tree-il/peval.scm +1669 -0
- data/share/guile/2.2/language/tree-il/primitives.scm +630 -0
- data/share/guile/2.2/language/tree-il/spec.scm +46 -0
- data/share/guile/2.2/language/tree-il.scm +630 -0
- data/share/guile/2.2/language/value/spec.scm +30 -0
- data/share/guile/2.2/oop/goops/accessors.scm +72 -0
- data/share/guile/2.2/oop/goops/active-slot.scm +63 -0
- data/share/guile/2.2/oop/goops/composite-slot.scm +83 -0
- data/share/guile/2.2/oop/goops/describe.scm +189 -0
- data/share/guile/2.2/oop/goops/internal.scm +30 -0
- data/share/guile/2.2/oop/goops/save.scm +874 -0
- data/share/guile/2.2/oop/goops/simple.scm +30 -0
- data/share/guile/2.2/oop/goops/stklos.scm +74 -0
- data/share/guile/2.2/oop/goops.scm +3176 -0
- data/share/guile/2.2/rnrs/arithmetic/bitwise.scm +92 -0
- data/share/guile/2.2/rnrs/arithmetic/fixnums.scm +291 -0
- data/share/guile/2.2/rnrs/arithmetic/flonums.scm +203 -0
- data/share/guile/2.2/rnrs/base.scm +291 -0
- data/share/guile/2.2/rnrs/bytevectors.scm +83 -0
- data/share/guile/2.2/rnrs/conditions.scm +225 -0
- data/share/guile/2.2/rnrs/control.scm +22 -0
- data/share/guile/2.2/rnrs/enums.scm +152 -0
- data/share/guile/2.2/rnrs/eval.scm +39 -0
- data/share/guile/2.2/rnrs/exceptions.scm +276 -0
- data/share/guile/2.2/rnrs/files.scm +96 -0
- data/share/guile/2.2/rnrs/hashtables.scm +190 -0
- data/share/guile/2.2/rnrs/io/ports.scm +554 -0
- data/share/guile/2.2/rnrs/io/simple.scm +167 -0
- data/share/guile/2.2/rnrs/lists.scm +55 -0
- data/share/guile/2.2/rnrs/mutable-pairs.scm +23 -0
- data/share/guile/2.2/rnrs/mutable-strings.scm +23 -0
- data/share/guile/2.2/rnrs/programs.scm +22 -0
- data/share/guile/2.2/rnrs/r5rs.scm +34 -0
- data/share/guile/2.2/rnrs/records/inspection.scm +81 -0
- data/share/guile/2.2/rnrs/records/procedural.scm +289 -0
- data/share/guile/2.2/rnrs/records/syntactic.scm +248 -0
- data/share/guile/2.2/rnrs/sorting.scm +27 -0
- data/share/guile/2.2/rnrs/syntax-case.scm +68 -0
- data/share/guile/2.2/rnrs/unicode.scm +104 -0
- data/share/guile/2.2/rnrs.scm +289 -0
- data/share/guile/2.2/scripts/api-diff.scm +179 -0
- data/share/guile/2.2/scripts/autofrisk.scm +218 -0
- data/share/guile/2.2/scripts/compile.scm +273 -0
- data/share/guile/2.2/scripts/disassemble.scm +38 -0
- data/share/guile/2.2/scripts/display-commentary.scm +67 -0
- data/share/guile/2.2/scripts/doc-snarf.scm +439 -0
- data/share/guile/2.2/scripts/frisk.scm +290 -0
- data/share/guile/2.2/scripts/generate-autoload.scm +144 -0
- data/share/guile/2.2/scripts/help.scm +188 -0
- data/share/guile/2.2/scripts/lint.scm +318 -0
- data/share/guile/2.2/scripts/list.scm +91 -0
- data/share/guile/2.2/scripts/punify.scm +87 -0
- data/share/guile/2.2/scripts/read-rfc822.scm +131 -0
- data/share/guile/2.2/scripts/read-scheme-source.scm +282 -0
- data/share/guile/2.2/scripts/read-text-outline.scm +253 -0
- data/share/guile/2.2/scripts/scan-api.scm +223 -0
- data/share/guile/2.2/scripts/snarf-check-and-output-texi.scm +303 -0
- data/share/guile/2.2/scripts/snarf-guile-m4-docs.scm +86 -0
- data/share/guile/2.2/scripts/summarize-guile-TODO.scm +213 -0
- data/share/guile/2.2/scripts/use2dot.scm +110 -0
- data/share/guile/2.2/srfi/srfi-1.scm +1061 -0
- data/share/guile/2.2/srfi/srfi-10.scm +89 -0
- data/share/guile/2.2/srfi/srfi-11.scm +146 -0
- data/share/guile/2.2/srfi/srfi-111.scm +37 -0
- data/share/guile/2.2/srfi/srfi-13.scm +132 -0
- data/share/guile/2.2/srfi/srfi-14.scm +99 -0
- data/share/guile/2.2/srfi/srfi-16.scm +51 -0
- data/share/guile/2.2/srfi/srfi-17.scm +174 -0
- data/share/guile/2.2/srfi/srfi-18.scm +382 -0
- data/share/guile/2.2/srfi/srfi-19.scm +1470 -0
- data/share/guile/2.2/srfi/srfi-2.scm +31 -0
- data/share/guile/2.2/srfi/srfi-26.scm +66 -0
- data/share/guile/2.2/srfi/srfi-27.scm +96 -0
- data/share/guile/2.2/srfi/srfi-28.scm +34 -0
- data/share/guile/2.2/srfi/srfi-31.scm +35 -0
- data/share/guile/2.2/srfi/srfi-34.scm +84 -0
- data/share/guile/2.2/srfi/srfi-35.scm +351 -0
- data/share/guile/2.2/srfi/srfi-37.scm +234 -0
- data/share/guile/2.2/srfi/srfi-38.scm +207 -0
- data/share/guile/2.2/srfi/srfi-39.scm +55 -0
- data/share/guile/2.2/srfi/srfi-4/gnu.scm +80 -0
- data/share/guile/2.2/srfi/srfi-4.scm +118 -0
- data/share/guile/2.2/srfi/srfi-41.scm +505 -0
- data/share/guile/2.2/srfi/srfi-42/ec.scm +1053 -0
- data/share/guile/2.2/srfi/srfi-42.scm +66 -0
- data/share/guile/2.2/srfi/srfi-43.scm +1077 -0
- data/share/guile/2.2/srfi/srfi-45.scm +93 -0
- data/share/guile/2.2/srfi/srfi-6.scm +29 -0
- data/share/guile/2.2/srfi/srfi-60.scm +73 -0
- data/share/guile/2.2/srfi/srfi-64/testing.scm +1040 -0
- data/share/guile/2.2/srfi/srfi-64.scm +55 -0
- data/share/guile/2.2/srfi/srfi-67/compare.scm +686 -0
- data/share/guile/2.2/srfi/srfi-67.scm +88 -0
- data/share/guile/2.2/srfi/srfi-69.scm +336 -0
- data/share/guile/2.2/srfi/srfi-71.scm +267 -0
- data/share/guile/2.2/srfi/srfi-8.scm +31 -0
- data/share/guile/2.2/srfi/srfi-88.scm +53 -0
- data/share/guile/2.2/srfi/srfi-9/gnu.scm +168 -0
- data/share/guile/2.2/srfi/srfi-9.scm +351 -0
- data/share/guile/2.2/srfi/srfi-98.scm +44 -0
- data/share/guile/2.2/statprof.scm +988 -0
- data/share/guile/2.2/sxml/apply-templates.scm +102 -0
- data/share/guile/2.2/sxml/fold.scm +250 -0
- data/share/guile/2.2/sxml/match.scm +75 -0
- data/share/guile/2.2/sxml/simple.scm +408 -0
- data/share/guile/2.2/sxml/ssax/input-parse.scm +180 -0
- data/share/guile/2.2/sxml/ssax.scm +265 -0
- data/share/guile/2.2/sxml/sxml-match.ss +1181 -0
- data/share/guile/2.2/sxml/transform.scm +298 -0
- data/share/guile/2.2/sxml/upstream/SSAX.scm +3235 -0
- data/share/guile/2.2/sxml/upstream/SXML-tree-trans.scm +249 -0
- data/share/guile/2.2/sxml/upstream/SXPath-old.scm +1216 -0
- data/share/guile/2.2/sxml/upstream/assert.scm +35 -0
- data/share/guile/2.2/sxml/upstream/input-parse.scm +326 -0
- data/share/guile/2.2/sxml/xpath.scm +493 -0
- data/share/guile/2.2/system/base/ck.scm +55 -0
- data/share/guile/2.2/system/base/compile.scm +282 -0
- data/share/guile/2.2/system/base/lalr.scm +51 -0
- data/share/guile/2.2/system/base/lalr.upstream.scm +2096 -0
- data/share/guile/2.2/system/base/language.scm +119 -0
- data/share/guile/2.2/system/base/message.scm +238 -0
- data/share/guile/2.2/system/base/pmatch.scm +68 -0
- data/share/guile/2.2/system/base/syntax.scm +299 -0
- data/share/guile/2.2/system/base/target.scm +152 -0
- data/share/guile/2.2/system/base/types.scm +561 -0
- data/share/guile/2.2/system/foreign-object.scm +91 -0
- data/share/guile/2.2/system/foreign.scm +200 -0
- data/share/guile/2.2/system/repl/command.scm +946 -0
- data/share/guile/2.2/system/repl/common.scm +263 -0
- data/share/guile/2.2/system/repl/coop-server.scm +200 -0
- data/share/guile/2.2/system/repl/debug.scm +210 -0
- data/share/guile/2.2/system/repl/describe.scm +347 -0
- data/share/guile/2.2/system/repl/error-handling.scm +183 -0
- data/share/guile/2.2/system/repl/repl.scm +233 -0
- data/share/guile/2.2/system/repl/server.scm +332 -0
- data/share/guile/2.2/system/syntax.scm +33 -0
- data/share/guile/2.2/system/vm/assembler.scm +2614 -0
- data/share/guile/2.2/system/vm/coverage.scm +351 -0
- data/share/guile/2.2/system/vm/debug.scm +766 -0
- data/share/guile/2.2/system/vm/disassembler.scm +658 -0
- data/share/guile/2.2/system/vm/dwarf.scm +1852 -0
- data/share/guile/2.2/system/vm/elf.scm +1042 -0
- data/share/guile/2.2/system/vm/frame.scm +485 -0
- data/share/guile/2.2/system/vm/inspect.scm +188 -0
- data/share/guile/2.2/system/vm/linker.scm +732 -0
- data/share/guile/2.2/system/vm/loader.scm +27 -0
- data/share/guile/2.2/system/vm/program.scm +312 -0
- data/share/guile/2.2/system/vm/trace.scm +121 -0
- data/share/guile/2.2/system/vm/trap-state.scm +302 -0
- data/share/guile/2.2/system/vm/traps.scm +608 -0
- data/share/guile/2.2/system/vm/vm.scm +32 -0
- data/share/guile/2.2/system/xref.scm +369 -0
- data/share/guile/2.2/texinfo/docbook.scm +240 -0
- data/share/guile/2.2/texinfo/html.scm +279 -0
- data/share/guile/2.2/texinfo/indexing.scm +75 -0
- data/share/guile/2.2/texinfo/plain-text.scm +322 -0
- data/share/guile/2.2/texinfo/reflection.scm +585 -0
- data/share/guile/2.2/texinfo/serialize.scm +300 -0
- data/share/guile/2.2/texinfo/string-utils.scm +410 -0
- data/share/guile/2.2/texinfo.scm +1263 -0
- data/share/guile/2.2/web/client.scm +513 -0
- data/share/guile/2.2/web/http.scm +2043 -0
- data/share/guile/2.2/web/request.scm +326 -0
- data/share/guile/2.2/web/response.scm +379 -0
- data/share/guile/2.2/web/server/http.scm +183 -0
- data/share/guile/2.2/web/server.scm +397 -0
- data/share/guile/2.2/web/uri.scm +552 -0
- data/share/lilypond/2.24.1/fontconfig/0bd3dc0958fa2205aaaa8ebb13e2872b-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/188ac73a183f12857f63bb60a4a6d603-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/32b6488e5b8292a2e95c79d947e009e8-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/3830d5c3ddfd5cd38a049b759396e72e-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/3f7329c5293ffd510edef78f73874cfd-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/4c599c202bc5c08e2d34565a40eac3b2-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/57e423e26b20ab21d0f2f29c145174c3-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/7ef2298fde41cc6eeb7af42e48b7d293-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/826f6b6ef79022e2eac8af26bf4b62f2-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/945677eb7aeaf62f1d50efc3fb3ec7d8-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/95530828ff6c81d309f8258d8d02a23e-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/CACHEDIR.TAG +4 -0
- data/share/lilypond/2.24.1/fontconfig/bf3b770c553c462765856025a94f1ce6-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/c855463f699352c367813e37f3f70ea7-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/d3e5c4ee2ceb1fc347f91d4cefc53bc0-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/d589a48862398ed80a3d6066f4f56f4c-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/d82eb4fd963d448e2fcb7d7b793b5df3-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/e13b20fdb08344e0e664864cc2ede53d-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/e52a45a1c8c8fe895fc0fc8c4e6999b8-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fontconfig/f1f2465696798768e9653f19e17ccdc8-le64.cache-8 +0 -0
- data/share/lilypond/2.24.1/fonts/00-lilypond-fonts.conf +99 -0
- data/share/lilypond/2.24.1/fonts/99-lilypond-fonts.conf +28 -0
- data/share/lilypond/2.24.1/fonts/otf/C059-BdIta.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/C059-Bold.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/C059-Italic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/C059-Roman.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/NimbusMonoPS-Bold.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/NimbusMonoPS-BoldItalic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/NimbusMonoPS-Italic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/NimbusMonoPS-Regular.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/NimbusSans-Bold.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/NimbusSans-BoldItalic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/NimbusSans-Italic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/NimbusSans-Regular.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/emmentaler-11.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/emmentaler-13.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/emmentaler-14.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/emmentaler-16.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/emmentaler-18.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/emmentaler-20.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/emmentaler-23.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/emmentaler-26.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/emmentaler-brace.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyrecursor-bold.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyrecursor-bolditalic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyrecursor-italic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyrecursor-regular.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyreheros-bold.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyreheros-bolditalic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyreheros-italic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyreheros-regular.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyreschola-bold.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyreschola-bolditalic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyreschola-italic.otf +0 -0
- data/share/lilypond/2.24.1/fonts/otf/texgyreschola-regular.otf +0 -0
- data/share/lilypond/2.24.1/fonts/source/common-modules-and-initialization.mf +26 -0
- data/share/lilypond/2.24.1/fonts/source/debugging-settings.mf +14 -0
- data/share/lilypond/2.24.1/fonts/source/declare-autometric-parameters.mf +9 -0
- data/share/lilypond/2.24.1/fonts/source/feta-accidentals.mf +58 -0
- data/share/lilypond/2.24.1/fonts/source/feta-accordion.mf +575 -0
- data/share/lilypond/2.24.1/fonts/source/feta-alphabet-generic.mf +16 -0
- data/share/lilypond/2.24.1/fonts/source/feta-alphabet11.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-alphabet13.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-alphabet14.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-alphabet16.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-alphabet18.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-alphabet20.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-alphabet23.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-alphabet26.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-arrow.mf +114 -0
- data/share/lilypond/2.24.1/fonts/source/feta-arrowheads.mf +171 -0
- data/share/lilypond/2.24.1/fonts/source/feta-autometric.mf +303 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-a.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-b.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-c.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-d.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-e.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-f.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-g.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-generic.mf +47 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-h.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces-i.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-braces.mf +125 -0
- data/share/lilypond/2.24.1/fonts/source/feta-brackettips.mf +100 -0
- data/share/lilypond/2.24.1/fonts/source/feta-clefs.mf +963 -0
- data/share/lilypond/2.24.1/fonts/source/feta-dots.mf +37 -0
- data/share/lilypond/2.24.1/fonts/source/feta-dynamics.mf +891 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags-generic.mf +17 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags.mf +926 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags11.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags13.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags14.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags16.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags18.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags20.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags23.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flags26.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-flats.mf +668 -0
- data/share/lilypond/2.24.1/fonts/source/feta-macros.mf +506 -0
- data/share/lilypond/2.24.1/fonts/source/feta-naturals.mf +223 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads-generic.mf +17 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads.mf +2642 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads11.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads13.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads14.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads16.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads18.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads20.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads23.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-noteheads26.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta-numbers.mf +1677 -0
- data/share/lilypond/2.24.1/fonts/source/feta-other-generic.mf +27 -0
- data/share/lilypond/2.24.1/fonts/source/feta-params.mf +323 -0
- data/share/lilypond/2.24.1/fonts/source/feta-parenthesis.mf +63 -0
- data/share/lilypond/2.24.1/fonts/source/feta-pedals.mf +355 -0
- data/share/lilypond/2.24.1/fonts/source/feta-rests.mf +890 -0
- data/share/lilypond/2.24.1/fonts/source/feta-scripts.mf +2206 -0
- data/share/lilypond/2.24.1/fonts/source/feta-sharps.mf +524 -0
- data/share/lilypond/2.24.1/fonts/source/feta-sori-koron.mf +325 -0
- data/share/lilypond/2.24.1/fonts/source/feta-ties.mf +72 -0
- data/share/lilypond/2.24.1/fonts/source/feta-timesignatures.mf +119 -0
- data/share/lilypond/2.24.1/fonts/source/feta-trills.mf +321 -0
- data/share/lilypond/2.24.1/fonts/source/feta11.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta13.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta14.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta16.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta18.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta20.mf +7 -0
- data/share/lilypond/2.24.1/fonts/source/feta23.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/feta26.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-accidentals.mf +483 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-clefs.mf +1636 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-custodes.mf +503 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-dots.mf +62 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-flags.mf +319 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-macros.mf +225 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads-generic.mf +16 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads.mf +2191 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads11.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads13.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads14.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads16.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads18.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads20.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads23.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-noteheads26.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-other-generic.mf +24 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-rests.mf +428 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-scripts.mf +284 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan-timesignatures.mf +402 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan11.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan13.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan14.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan16.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan18.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan20.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan23.mf +6 -0
- data/share/lilypond/2.24.1/fonts/source/parmesan26.mf +6 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-11.svg +2525 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-11.woff +0 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-13.svg +2530 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-13.woff +0 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-14.svg +2526 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-14.woff +0 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-16.svg +2523 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-16.woff +0 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-18.svg +2519 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-18.woff +0 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-20.svg +2512 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-20.woff +0 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-23.svg +2506 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-23.woff +0 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-26.svg +2510 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-26.woff +0 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-brace.svg +1757 -0
- data/share/lilypond/2.24.1/fonts/svg/emmentaler-brace.woff +0 -0
- data/share/lilypond/2.24.1/ly/Welcome_to_LilyPond.ly +45 -0
- data/share/lilypond/2.24.1/ly/arabic.ly +185 -0
- data/share/lilypond/2.24.1/ly/articulate.ly +1013 -0
- data/share/lilypond/2.24.1/ly/bagpipe.ly +368 -0
- data/share/lilypond/2.24.1/ly/base-tkit.ly +135 -0
- data/share/lilypond/2.24.1/ly/catalan.ly +23 -0
- data/share/lilypond/2.24.1/ly/chord-modifiers-init.ly +63 -0
- data/share/lilypond/2.24.1/ly/chord-repetition-init.ly +60 -0
- data/share/lilypond/2.24.1/ly/context-mods-init.ly +119 -0
- data/share/lilypond/2.24.1/ly/declarations-init.ly +167 -0
- data/share/lilypond/2.24.1/ly/deutsch.ly +23 -0
- data/share/lilypond/2.24.1/ly/drumpitch-init.ly +366 -0
- data/share/lilypond/2.24.1/ly/dynamic-scripts-init.ly +54 -0
- data/share/lilypond/2.24.1/ly/english.ly +23 -0
- data/share/lilypond/2.24.1/ly/engraver-init.ly +1619 -0
- data/share/lilypond/2.24.1/ly/espanol.ly +23 -0
- data/share/lilypond/2.24.1/ly/event-listener.ly +241 -0
- data/share/lilypond/2.24.1/ly/festival.ly +38 -0
- data/share/lilypond/2.24.1/ly/generate-documentation.ly +7 -0
- data/share/lilypond/2.24.1/ly/grace-init.ly +56 -0
- data/share/lilypond/2.24.1/ly/graphviz-init.ly +174 -0
- data/share/lilypond/2.24.1/ly/gregorian.ly +268 -0
- data/share/lilypond/2.24.1/ly/guile-debugger.ly +55 -0
- data/share/lilypond/2.24.1/ly/hel-arabic.ly +307 -0
- data/share/lilypond/2.24.1/ly/init.ly +96 -0
- data/share/lilypond/2.24.1/ly/italiano.ly +23 -0
- data/share/lilypond/2.24.1/ly/lilypond-book-preamble.ly +47 -0
- data/share/lilypond/2.24.1/ly/lyrics-tkit.ly +68 -0
- data/share/lilypond/2.24.1/ly/makam.ly +166 -0
- data/share/lilypond/2.24.1/ly/midi-init.ly +59 -0
- data/share/lilypond/2.24.1/ly/music-functions-init.ly +2254 -0
- data/share/lilypond/2.24.1/ly/nederlands.ly +23 -0
- data/share/lilypond/2.24.1/ly/norsk.ly +23 -0
- data/share/lilypond/2.24.1/ly/paper-defaults-init.ly +188 -0
- data/share/lilypond/2.24.1/ly/performer-init.ly +398 -0
- data/share/lilypond/2.24.1/ly/persian.ly +335 -0
- data/share/lilypond/2.24.1/ly/piano-tkit.ly +61 -0
- data/share/lilypond/2.24.1/ly/portugues.ly +23 -0
- data/share/lilypond/2.24.1/ly/predefined-fretboards-init.ly +78 -0
- data/share/lilypond/2.24.1/ly/predefined-guitar-fretboards.ly +506 -0
- data/share/lilypond/2.24.1/ly/predefined-guitar-ninth-fretboards.ly +75 -0
- data/share/lilypond/2.24.1/ly/predefined-mandolin-fretboards.ly +876 -0
- data/share/lilypond/2.24.1/ly/predefined-ukulele-fretboards.ly +1285 -0
- data/share/lilypond/2.24.1/ly/property-init.ly +858 -0
- data/share/lilypond/2.24.1/ly/satb.ly +214 -0
- data/share/lilypond/2.24.1/ly/scale-definitions-init.ly +117 -0
- data/share/lilypond/2.24.1/ly/scheme-sandbox.ly +39 -0
- data/share/lilypond/2.24.1/ly/script-init.ly +94 -0
- data/share/lilypond/2.24.1/ly/spanners-init.ly +146 -0
- data/share/lilypond/2.24.1/ly/ssaattbb.ly +335 -0
- data/share/lilypond/2.24.1/ly/staff-tkit.ly +182 -0
- data/share/lilypond/2.24.1/ly/string-tunings-init.ly +94 -0
- data/share/lilypond/2.24.1/ly/suomi.ly +23 -0
- data/share/lilypond/2.24.1/ly/svenska.ly +23 -0
- data/share/lilypond/2.24.1/ly/swing.ly +362 -0
- data/share/lilypond/2.24.1/ly/text-replacements.ly +150 -0
- data/share/lilypond/2.24.1/ly/titling-init.ly +150 -0
- data/share/lilypond/2.24.1/ly/toc-init.ly +182 -0
- data/share/lilypond/2.24.1/ly/turkish-makam.ly +609 -0
- data/share/lilypond/2.24.1/ly/vlaams.ly +23 -0
- data/share/lilypond/2.24.1/ly/vocal-tkit.ly +103 -0
- data/share/lilypond/2.24.1/ly/voice-tkit.ly +34 -0
- data/share/lilypond/2.24.1/ps/encodingdefs.ps +2611 -0
- data/share/lilypond/2.24.1/ps/lilyponddefs.ps +49 -0
- data/share/lilypond/2.24.1/ps/music-drawing-routines.ps +329 -0
- data/share/lilypond/2.24.1/python/__pycache__/book_base.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/book_docbook.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/book_html.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/book_latex.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/book_snippets.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/book_texinfo.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/convertrules.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/langdefs.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/lilylib.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/midi.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/musicexp.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/musicxml.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/musicxml2ly_conversion.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/__pycache__/utilities.cpython-310.pyc +0 -0
- data/share/lilypond/2.24.1/python/book_base.py +331 -0
- data/share/lilypond/2.24.1/python/book_docbook.py +154 -0
- data/share/lilypond/2.24.1/python/book_html.py +178 -0
- data/share/lilypond/2.24.1/python/book_latex.py +373 -0
- data/share/lilypond/2.24.1/python/book_snippets.py +1052 -0
- data/share/lilypond/2.24.1/python/book_texinfo.py +437 -0
- data/share/lilypond/2.24.1/python/convertrules.py +4764 -0
- data/share/lilypond/2.24.1/python/langdefs.py +131 -0
- data/share/lilypond/2.24.1/python/lilylib.py +141 -0
- data/share/lilypond/2.24.1/python/midi.py +212 -0
- data/share/lilypond/2.24.1/python/musicexp.py +2781 -0
- data/share/lilypond/2.24.1/python/musicxml.py +1905 -0
- data/share/lilypond/2.24.1/python/musicxml2ly_conversion.py +80 -0
- data/share/lilypond/2.24.1/python/utilities.py +280 -0
- data/share/lilypond/2.24.1/scm/lily/accreg.scm +579 -0
- data/share/lilypond/2.24.1/scm/lily/auto-beam.scm +163 -0
- data/share/lilypond/2.24.1/scm/lily/autochange.scm +100 -0
- data/share/lilypond/2.24.1/scm/lily/backend-library.scm +593 -0
- data/share/lilypond/2.24.1/scm/lily/bar-line.scm +1281 -0
- data/share/lilypond/2.24.1/scm/lily/breath.scm +74 -0
- data/share/lilypond/2.24.1/scm/lily/c++.scm +174 -0
- data/share/lilypond/2.24.1/scm/lily/chord-entry.scm +278 -0
- data/share/lilypond/2.24.1/scm/lily/chord-ignatzek-names.scm +304 -0
- data/share/lilypond/2.24.1/scm/lily/chord-name.scm +217 -0
- data/share/lilypond/2.24.1/scm/lily/clip-region.scm +87 -0
- data/share/lilypond/2.24.1/scm/lily/color.scm +757 -0
- data/share/lilypond/2.24.1/scm/lily/curried-definitions.scm +68 -0
- data/share/lilypond/2.24.1/scm/lily/define-context-properties.scm +939 -0
- data/share/lilypond/2.24.1/scm/lily/define-event-classes.scm +142 -0
- data/share/lilypond/2.24.1/scm/lily/define-grob-interfaces.scm +640 -0
- data/share/lilypond/2.24.1/scm/lily/define-grob-properties.scm +1647 -0
- data/share/lilypond/2.24.1/scm/lily/define-grobs.scm +4027 -0
- data/share/lilypond/2.24.1/scm/lily/define-markup-commands.scm +5737 -0
- data/share/lilypond/2.24.1/scm/lily/define-music-callbacks.scm +257 -0
- data/share/lilypond/2.24.1/scm/lily/define-music-display-methods.scm +1350 -0
- data/share/lilypond/2.24.1/scm/lily/define-music-properties.scm +242 -0
- data/share/lilypond/2.24.1/scm/lily/define-music-types.scm +983 -0
- data/share/lilypond/2.24.1/scm/lily/define-note-names.scm +1421 -0
- data/share/lilypond/2.24.1/scm/lily/define-stencil-commands.scm +71 -0
- data/share/lilypond/2.24.1/scm/lily/define-woodwind-diagrams.scm +1215 -0
- data/share/lilypond/2.24.1/scm/lily/display-lily.scm +315 -0
- data/share/lilypond/2.24.1/scm/lily/display-woodwind-diagrams.scm +1985 -0
- data/share/lilypond/2.24.1/scm/lily/document-backend.scm +307 -0
- data/share/lilypond/2.24.1/scm/lily/document-context-mods.scm +98 -0
- data/share/lilypond/2.24.1/scm/lily/document-functions.scm +169 -0
- data/share/lilypond/2.24.1/scm/lily/document-identifiers.scm +76 -0
- data/share/lilypond/2.24.1/scm/lily/document-markup.scm +158 -0
- data/share/lilypond/2.24.1/scm/lily/document-music.scm +146 -0
- data/share/lilypond/2.24.1/scm/lily/document-outside-staff-priorities.scm +40 -0
- data/share/lilypond/2.24.1/scm/lily/document-paper-sizes.scm +71 -0
- data/share/lilypond/2.24.1/scm/lily/document-translation.scm +318 -0
- data/share/lilypond/2.24.1/scm/lily/document-type-predicates.scm +85 -0
- data/share/lilypond/2.24.1/scm/lily/documentation-generate.scm +259 -0
- data/share/lilypond/2.24.1/scm/lily/documentation-lib.scm +207 -0
- data/share/lilypond/2.24.1/scm/lily/file-cache.scm +28 -0
- data/share/lilypond/2.24.1/scm/lily/flag-styles.scm +249 -0
- data/share/lilypond/2.24.1/scm/lily/font-encodings.scm +1242 -0
- data/share/lilypond/2.24.1/scm/lily/font.scm +303 -0
- data/share/lilypond/2.24.1/scm/lily/framework-cairo.scm +26 -0
- data/share/lilypond/2.24.1/scm/lily/framework-ps.scm +896 -0
- data/share/lilypond/2.24.1/scm/lily/framework-svg.scm +172 -0
- data/share/lilypond/2.24.1/scm/lily/fret-diagrams.scm +1261 -0
- data/share/lilypond/2.24.1/scm/lily/graphviz.scm +78 -0
- data/share/lilypond/2.24.1/scm/lily/guile-debugger.scm +90 -0
- data/share/lilypond/2.24.1/scm/lily/harp-pedals.scm +172 -0
- data/share/lilypond/2.24.1/scm/lily/hyphenate-internal-words.scm +51 -0
- data/share/lilypond/2.24.1/scm/lily/layout-beam.scm +73 -0
- data/share/lilypond/2.24.1/scm/lily/layout-slur.scm +45 -0
- data/share/lilypond/2.24.1/scm/lily/lily-library.scm +1446 -0
- data/share/lilypond/2.24.1/scm/lily/lily-sort.scm +116 -0
- data/share/lilypond/2.24.1/scm/lily/lily.scm +929 -0
- data/share/lilypond/2.24.1/scm/lily/ly-syntax-constructors.scm +374 -0
- data/share/lilypond/2.24.1/scm/lily/markup-macros.scm +493 -0
- data/share/lilypond/2.24.1/scm/lily/markup.scm +126 -0
- data/share/lilypond/2.24.1/scm/lily/midi.scm +258 -0
- data/share/lilypond/2.24.1/scm/lily/modal-transforms.scm +337 -0
- data/share/lilypond/2.24.1/scm/lily/music-functions.scm +2878 -0
- data/share/lilypond/2.24.1/scm/lily/output-lib.scm +3377 -0
- data/share/lilypond/2.24.1/scm/lily/output-ps.scm +335 -0
- data/share/lilypond/2.24.1/scm/lily/output-svg.scm +684 -0
- data/share/lilypond/2.24.1/scm/lily/page.scm +321 -0
- data/share/lilypond/2.24.1/scm/lily/paper-system.scm +271 -0
- data/share/lilypond/2.24.1/scm/lily/paper.scm +376 -0
- data/share/lilypond/2.24.1/scm/lily/parser-clef.scm +205 -0
- data/share/lilypond/2.24.1/scm/lily/parser-ly-from-scheme.scm +170 -0
- data/share/lilypond/2.24.1/scm/lily/part-combiner.scm +998 -0
- data/share/lilypond/2.24.1/scm/lily/predefined-fretboards.scm +54 -0
- data/share/lilypond/2.24.1/scm/lily/ps-to-png.scm +182 -0
- data/share/lilypond/2.24.1/scm/lily/scheme-engravers.scm +1813 -0
- data/share/lilypond/2.24.1/scm/lily/scheme-performers.scm +126 -0
- data/share/lilypond/2.24.1/scm/lily/script.scm +416 -0
- data/share/lilypond/2.24.1/scm/lily/skyline.scm +25 -0
- data/share/lilypond/2.24.1/scm/lily/song-util.scm +191 -0
- data/share/lilypond/2.24.1/scm/lily/song.scm +853 -0
- data/share/lilypond/2.24.1/scm/lily/stencil.scm +998 -0
- data/share/lilypond/2.24.1/scm/lily/tablature.scm +392 -0
- data/share/lilypond/2.24.1/scm/lily/time-signature-settings.scm +473 -0
- data/share/lilypond/2.24.1/scm/lily/time-signature.scm +35 -0
- data/share/lilypond/2.24.1/scm/lily/titling.scm +99 -0
- data/share/lilypond/2.24.1/scm/lily/to-xml.scm +254 -0
- data/share/lilypond/2.24.1/scm/lily/translation-functions.scm +1169 -0
- data/share/lilypond/2.24.1/vim/compiler/lilypond.vim +36 -0
- data/share/lilypond/2.24.1/vim/ftdetect/lilypond.vim +4 -0
- data/share/lilypond/2.24.1/vim/ftplugin/lilypond.vim +91 -0
- data/share/lilypond/2.24.1/vim/indent/lilypond.vim +79 -0
- data/share/lilypond/2.24.1/vim/syntax/lilypond-words +1408 -0
- data/share/lilypond/2.24.1/vim/syntax/lilypond-words.vim +3 -0
- data/share/lilypond/2.24.1/vim/syntax/lilypond.vim +104 -0
- data/share/locale/ca/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/cs/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/da/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/de/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/el/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/eo/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/es/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/fi/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/fr/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/it/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/ja/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/nl/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/ru/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/sv/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/tr/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/uk/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/vi/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/zh_CN/LC_MESSAGES/lilypond.mo +0 -0
- data/share/locale/zh_TW/LC_MESSAGES/lilypond.mo +0 -0
- metadata +1135 -4
@@ -0,0 +1,3326 @@
|
|
1
|
+
;;;; -*-scheme-*-
|
2
|
+
;;;;
|
3
|
+
;;;; Copyright (C) 2001, 2003, 2006, 2009, 2010, 2011,
|
4
|
+
;;;; 2012, 2013, 2015, 2016, 2019 Free Software Foundation, Inc.
|
5
|
+
;;;;
|
6
|
+
;;;; This library is free software; you can redistribute it and/or
|
7
|
+
;;;; modify it under the terms of the GNU Lesser General Public
|
8
|
+
;;;; License as published by the Free Software Foundation; either
|
9
|
+
;;;; version 3 of the License, or (at your option) any later version.
|
10
|
+
;;;;
|
11
|
+
;;;; This library is distributed in the hope that it will be useful,
|
12
|
+
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
;;;; Lesser General Public License for more details.
|
15
|
+
;;;;
|
16
|
+
;;;; You should have received a copy of the GNU Lesser General Public
|
17
|
+
;;;; License along with this library; if not, write to the Free Software
|
18
|
+
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
19
|
+
;;;;
|
20
|
+
|
21
|
+
|
22
|
+
;;; Portable implementation of syntax-case
|
23
|
+
;;; Originally extracted from Chez Scheme Version 5.9f
|
24
|
+
;;; Authors: R. Kent Dybvig, Oscar Waddell, Bob Hieb, Carl Bruggeman
|
25
|
+
|
26
|
+
;;; Copyright (c) 1992-1997 Cadence Research Systems
|
27
|
+
;;; Permission to copy this software, in whole or in part, to use this
|
28
|
+
;;; software for any lawful purpose, and to redistribute this software
|
29
|
+
;;; is granted subject to the restriction that all copies made of this
|
30
|
+
;;; software must include this copyright notice in full. This software
|
31
|
+
;;; is provided AS IS, with NO WARRANTY, EITHER EXPRESS OR IMPLIED,
|
32
|
+
;;; INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY
|
33
|
+
;;; OR FITNESS FOR ANY PARTICULAR PURPOSE. IN NO EVENT SHALL THE
|
34
|
+
;;; AUTHORS BE LIABLE FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES OF ANY
|
35
|
+
;;; NATURE WHATSOEVER.
|
36
|
+
|
37
|
+
;;; Modified by Mikael Djurfeldt <djurfeldt@nada.kth.se> according
|
38
|
+
;;; to the ChangeLog distributed in the same directory as this file:
|
39
|
+
;;; 1997-08-19, 1997-09-03, 1997-09-10, 2000-08-13, 2000-08-24,
|
40
|
+
;;; 2000-09-12, 2001-03-08
|
41
|
+
|
42
|
+
;;; Modified by Andy Wingo <wingo@pobox.com> according to the Git
|
43
|
+
;;; revision control logs corresponding to this file: 2009, 2010.
|
44
|
+
|
45
|
+
;;; Modified by Mark H Weaver <mhw@netris.org> according to the Git
|
46
|
+
;;; revision control logs corresponding to this file: 2012, 2013.
|
47
|
+
|
48
|
+
|
49
|
+
;;; This code is based on "Syntax Abstraction in Scheme"
|
50
|
+
;;; by R. Kent Dybvig, Robert Hieb, and Carl Bruggeman.
|
51
|
+
;;; Lisp and Symbolic Computation 5:4, 295-326, 1992.
|
52
|
+
;;; <http://www.cs.indiana.edu/~dyb/pubs/LaSC-5-4-pp295-326.pdf>
|
53
|
+
|
54
|
+
|
55
|
+
;;; This file defines the syntax-case expander, macroexpand, and a set
|
56
|
+
;;; of associated syntactic forms and procedures. Of these, the
|
57
|
+
;;; following are documented in The Scheme Programming Language,
|
58
|
+
;;; Fourth Edition (R. Kent Dybvig, MIT Press, 2009), and in the
|
59
|
+
;;; R6RS:
|
60
|
+
;;;
|
61
|
+
;;; bound-identifier=?
|
62
|
+
;;; datum->syntax
|
63
|
+
;;; define-syntax
|
64
|
+
;;; syntax-parameterize
|
65
|
+
;;; free-identifier=?
|
66
|
+
;;; generate-temporaries
|
67
|
+
;;; identifier?
|
68
|
+
;;; identifier-syntax
|
69
|
+
;;; let-syntax
|
70
|
+
;;; letrec-syntax
|
71
|
+
;;; syntax
|
72
|
+
;;; syntax-case
|
73
|
+
;;; syntax->datum
|
74
|
+
;;; syntax-rules
|
75
|
+
;;; with-syntax
|
76
|
+
;;;
|
77
|
+
;;; Additionally, the expander provides definitions for a number of core
|
78
|
+
;;; Scheme syntactic bindings, such as `let', `lambda', and the like.
|
79
|
+
|
80
|
+
;;; The remaining exports are listed below:
|
81
|
+
;;;
|
82
|
+
;;; (macroexpand datum)
|
83
|
+
;;; if datum represents a valid expression, macroexpand returns an
|
84
|
+
;;; expanded version of datum in a core language that includes no
|
85
|
+
;;; syntactic abstractions. The core language includes begin,
|
86
|
+
;;; define, if, lambda, letrec, quote, and set!.
|
87
|
+
;;; (eval-when situations expr ...)
|
88
|
+
;;; conditionally evaluates expr ... at compile-time or run-time
|
89
|
+
;;; depending upon situations (see the Chez Scheme System Manual,
|
90
|
+
;;; Revision 3, for a complete description)
|
91
|
+
;;; (syntax-violation who message form [subform])
|
92
|
+
;;; used to report errors found during expansion
|
93
|
+
;;; ($sc-dispatch e p)
|
94
|
+
;;; used by expanded code to handle syntax-case matching
|
95
|
+
|
96
|
+
;;; This file is shipped along with an expanded version of itself,
|
97
|
+
;;; psyntax-pp.scm, which is loaded when psyntax.scm has not yet been
|
98
|
+
;;; compiled. In this way, psyntax bootstraps off of an expanded
|
99
|
+
;;; version of itself.
|
100
|
+
|
101
|
+
;;; This implementation of the expander sometimes uses syntactic
|
102
|
+
;;; abstractions when procedural abstractions would suffice. For
|
103
|
+
;;; example, we define top-wrap and top-marked? as
|
104
|
+
;;;
|
105
|
+
;;; (define-syntax top-wrap (identifier-syntax '((top))))
|
106
|
+
;;; (define-syntax top-marked?
|
107
|
+
;;; (syntax-rules ()
|
108
|
+
;;; ((_ w) (memq 'top (wrap-marks w)))))
|
109
|
+
;;;
|
110
|
+
;;; rather than
|
111
|
+
;;;
|
112
|
+
;;; (define top-wrap '((top)))
|
113
|
+
;;; (define top-marked?
|
114
|
+
;;; (lambda (w) (memq 'top (wrap-marks w))))
|
115
|
+
;;;
|
116
|
+
;;; On the other hand, we don't do this consistently; we define
|
117
|
+
;;; make-wrap, wrap-marks, and wrap-subst simply as
|
118
|
+
;;;
|
119
|
+
;;; (define make-wrap cons)
|
120
|
+
;;; (define wrap-marks car)
|
121
|
+
;;; (define wrap-subst cdr)
|
122
|
+
;;;
|
123
|
+
;;; In Chez Scheme, the syntactic and procedural forms of these
|
124
|
+
;;; abstractions are equivalent, since the optimizer consistently
|
125
|
+
;;; integrates constants and small procedures. This will be true of
|
126
|
+
;;; Guile as well, once we implement a proper inliner.
|
127
|
+
|
128
|
+
|
129
|
+
;;; Implementation notes:
|
130
|
+
|
131
|
+
;;; Objects with no standard print syntax, including objects containing
|
132
|
+
;;; cycles and syntax object, are allowed in quoted data as long as they
|
133
|
+
;;; are contained within a syntax form or produced by datum->syntax.
|
134
|
+
;;; Such objects are never copied.
|
135
|
+
|
136
|
+
;;; All identifiers that don't have macro definitions and are not bound
|
137
|
+
;;; lexically are assumed to be global variables.
|
138
|
+
|
139
|
+
;;; Top-level definitions of macro-introduced identifiers are allowed.
|
140
|
+
;;; This may not be appropriate for implementations in which the
|
141
|
+
;;; model is that bindings are created by definitions, as opposed to
|
142
|
+
;;; one in which initial values are assigned by definitions.
|
143
|
+
|
144
|
+
;;; Identifiers and syntax objects are implemented as vectors for
|
145
|
+
;;; portability. As a result, it is possible to "forge" syntax objects.
|
146
|
+
|
147
|
+
;;; The implementation of generate-temporaries assumes that it is
|
148
|
+
;;; possible to generate globally unique symbols (gensyms).
|
149
|
+
|
150
|
+
;;; The source location associated with incoming expressions is tracked
|
151
|
+
;;; via the source-properties mechanism, a weak map from expression to
|
152
|
+
;;; source information. At times the source is separated from the
|
153
|
+
;;; expression; see the note below about "efficiency and confusion".
|
154
|
+
|
155
|
+
|
156
|
+
;;; Bootstrapping:
|
157
|
+
|
158
|
+
;;; When changing syntax-object representations, it is necessary to support
|
159
|
+
;;; both old and new syntax-object representations in id-var-name. It
|
160
|
+
;;; should be sufficient to recognize old representations and treat
|
161
|
+
;;; them as not lexically bound.
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
(eval-when (compile)
|
166
|
+
(set-current-module (resolve-module '(guile))))
|
167
|
+
|
168
|
+
(let ((syntax? (module-ref (current-module) 'syntax?))
|
169
|
+
(make-syntax (module-ref (current-module) 'make-syntax))
|
170
|
+
(syntax-expression (module-ref (current-module) 'syntax-expression))
|
171
|
+
(syntax-wrap (module-ref (current-module) 'syntax-wrap))
|
172
|
+
(syntax-module (module-ref (current-module) 'syntax-module)))
|
173
|
+
|
174
|
+
(define-syntax define-expansion-constructors
|
175
|
+
(lambda (x)
|
176
|
+
(syntax-case x ()
|
177
|
+
((_)
|
178
|
+
(let lp ((n 0) (out '()))
|
179
|
+
(if (< n (vector-length %expanded-vtables))
|
180
|
+
(lp (1+ n)
|
181
|
+
(let* ((vtable (vector-ref %expanded-vtables n))
|
182
|
+
(stem (struct-ref vtable (+ vtable-offset-user 0)))
|
183
|
+
(fields (struct-ref vtable (+ vtable-offset-user 2)))
|
184
|
+
(sfields (map (lambda (f) (datum->syntax x f)) fields))
|
185
|
+
(ctor (datum->syntax x (symbol-append 'make- stem))))
|
186
|
+
(cons #`(define (#,ctor #,@sfields)
|
187
|
+
(make-struct/no-tail
|
188
|
+
(vector-ref %expanded-vtables #,n)
|
189
|
+
#,@sfields))
|
190
|
+
out)))
|
191
|
+
#`(begin #,@(reverse out))))))))
|
192
|
+
|
193
|
+
(define-syntax define-expansion-accessors
|
194
|
+
(lambda (x)
|
195
|
+
(syntax-case x ()
|
196
|
+
((_ stem field ...)
|
197
|
+
(let lp ((n 0))
|
198
|
+
(let ((vtable (vector-ref %expanded-vtables n))
|
199
|
+
(stem (syntax->datum #'stem)))
|
200
|
+
(if (eq? (struct-ref vtable (+ vtable-offset-user 0)) stem)
|
201
|
+
#`(begin
|
202
|
+
(define (#,(datum->syntax x (symbol-append stem '?)) x)
|
203
|
+
(and (struct? x)
|
204
|
+
(eq? (struct-vtable x)
|
205
|
+
(vector-ref %expanded-vtables #,n))))
|
206
|
+
#,@(map
|
207
|
+
(lambda (f)
|
208
|
+
(let ((get (datum->syntax x (symbol-append stem '- f)))
|
209
|
+
(set (datum->syntax x (symbol-append 'set- stem '- f '!)))
|
210
|
+
(idx (list-index (struct-ref vtable
|
211
|
+
(+ vtable-offset-user 2))
|
212
|
+
f)))
|
213
|
+
#`(begin
|
214
|
+
(define (#,get x)
|
215
|
+
(struct-ref x #,idx))
|
216
|
+
(define (#,set x v)
|
217
|
+
(struct-set! x #,idx v)))))
|
218
|
+
(syntax->datum #'(field ...))))
|
219
|
+
(lp (1+ n)))))))))
|
220
|
+
|
221
|
+
(define-syntax define-structure
|
222
|
+
(lambda (x)
|
223
|
+
(define construct-name
|
224
|
+
(lambda (template-identifier . args)
|
225
|
+
(datum->syntax
|
226
|
+
template-identifier
|
227
|
+
(string->symbol
|
228
|
+
(apply string-append
|
229
|
+
(map (lambda (x)
|
230
|
+
(if (string? x)
|
231
|
+
x
|
232
|
+
(symbol->string (syntax->datum x))))
|
233
|
+
args))))))
|
234
|
+
(syntax-case x ()
|
235
|
+
((_ (name id1 ...))
|
236
|
+
(and-map identifier? #'(name id1 ...))
|
237
|
+
(with-syntax
|
238
|
+
((constructor (construct-name #'name "make-" #'name))
|
239
|
+
(predicate (construct-name #'name #'name "?"))
|
240
|
+
((access ...)
|
241
|
+
(map (lambda (x) (construct-name x #'name "-" x))
|
242
|
+
#'(id1 ...)))
|
243
|
+
((assign ...)
|
244
|
+
(map (lambda (x)
|
245
|
+
(construct-name x "set-" #'name "-" x "!"))
|
246
|
+
#'(id1 ...)))
|
247
|
+
(structure-length
|
248
|
+
(+ (length #'(id1 ...)) 1))
|
249
|
+
((index ...)
|
250
|
+
(let f ((i 1) (ids #'(id1 ...)))
|
251
|
+
(if (null? ids)
|
252
|
+
'()
|
253
|
+
(cons i (f (+ i 1) (cdr ids)))))))
|
254
|
+
#'(begin
|
255
|
+
(define constructor
|
256
|
+
(lambda (id1 ...)
|
257
|
+
(vector 'name id1 ... )))
|
258
|
+
(define predicate
|
259
|
+
(lambda (x)
|
260
|
+
(and (vector? x)
|
261
|
+
(= (vector-length x) structure-length)
|
262
|
+
(eq? (vector-ref x 0) 'name))))
|
263
|
+
(define access
|
264
|
+
(lambda (x)
|
265
|
+
(vector-ref x index)))
|
266
|
+
...
|
267
|
+
(define assign
|
268
|
+
(lambda (x update)
|
269
|
+
(vector-set! x index update)))
|
270
|
+
...))))))
|
271
|
+
|
272
|
+
(let ()
|
273
|
+
(define-expansion-constructors)
|
274
|
+
(define-expansion-accessors lambda meta)
|
275
|
+
|
276
|
+
;; hooks to nonportable run-time helpers
|
277
|
+
(begin
|
278
|
+
(define-syntax fx+ (identifier-syntax +))
|
279
|
+
(define-syntax fx- (identifier-syntax -))
|
280
|
+
(define-syntax fx= (identifier-syntax =))
|
281
|
+
(define-syntax fx< (identifier-syntax <))
|
282
|
+
|
283
|
+
(define top-level-eval-hook
|
284
|
+
(lambda (x mod)
|
285
|
+
(primitive-eval x)))
|
286
|
+
|
287
|
+
(define local-eval-hook
|
288
|
+
(lambda (x mod)
|
289
|
+
(primitive-eval x)))
|
290
|
+
|
291
|
+
;; Capture syntax-session-id before we shove it off into a module.
|
292
|
+
(define session-id
|
293
|
+
(let ((v (module-variable (current-module) 'syntax-session-id)))
|
294
|
+
(lambda ()
|
295
|
+
((variable-ref v))))))
|
296
|
+
|
297
|
+
(define (decorate-source e s)
|
298
|
+
(if (and s (supports-source-properties? e))
|
299
|
+
(set-source-properties! e s))
|
300
|
+
e)
|
301
|
+
|
302
|
+
(define (maybe-name-value! name val)
|
303
|
+
(if (lambda? val)
|
304
|
+
(let ((meta (lambda-meta val)))
|
305
|
+
(if (not (assq 'name meta))
|
306
|
+
(set-lambda-meta! val (acons 'name name meta))))))
|
307
|
+
|
308
|
+
;; output constructors
|
309
|
+
(define build-void
|
310
|
+
(lambda (source)
|
311
|
+
(make-void source)))
|
312
|
+
|
313
|
+
(define build-call
|
314
|
+
(lambda (source fun-exp arg-exps)
|
315
|
+
(make-call source fun-exp arg-exps)))
|
316
|
+
|
317
|
+
(define build-conditional
|
318
|
+
(lambda (source test-exp then-exp else-exp)
|
319
|
+
(make-conditional source test-exp then-exp else-exp)))
|
320
|
+
|
321
|
+
(define build-lexical-reference
|
322
|
+
(lambda (type source name var)
|
323
|
+
(make-lexical-ref source name var)))
|
324
|
+
|
325
|
+
(define build-lexical-assignment
|
326
|
+
(lambda (source name var exp)
|
327
|
+
(maybe-name-value! name exp)
|
328
|
+
(make-lexical-set source name var exp)))
|
329
|
+
|
330
|
+
(define (analyze-variable mod var modref-cont bare-cont)
|
331
|
+
(if (not mod)
|
332
|
+
(bare-cont var)
|
333
|
+
(let ((kind (car mod))
|
334
|
+
(mod (cdr mod)))
|
335
|
+
(case kind
|
336
|
+
((public) (modref-cont mod var #t))
|
337
|
+
((private) (if (not (equal? mod (module-name (current-module))))
|
338
|
+
(modref-cont mod var #f)
|
339
|
+
(bare-cont var)))
|
340
|
+
((bare) (bare-cont var))
|
341
|
+
((hygiene) (if (and (not (equal? mod (module-name (current-module))))
|
342
|
+
(module-variable (resolve-module mod) var))
|
343
|
+
(modref-cont mod var #f)
|
344
|
+
(bare-cont var)))
|
345
|
+
((primitive)
|
346
|
+
(syntax-violation #f "primitive not in operator position" var))
|
347
|
+
(else (syntax-violation #f "bad module kind" var mod))))))
|
348
|
+
|
349
|
+
(define build-global-reference
|
350
|
+
(lambda (source var mod)
|
351
|
+
(analyze-variable
|
352
|
+
mod var
|
353
|
+
(lambda (mod var public?)
|
354
|
+
(make-module-ref source mod var public?))
|
355
|
+
(lambda (var)
|
356
|
+
(make-toplevel-ref source var)))))
|
357
|
+
|
358
|
+
(define build-global-assignment
|
359
|
+
(lambda (source var exp mod)
|
360
|
+
(maybe-name-value! var exp)
|
361
|
+
(analyze-variable
|
362
|
+
mod var
|
363
|
+
(lambda (mod var public?)
|
364
|
+
(make-module-set source mod var public? exp))
|
365
|
+
(lambda (var)
|
366
|
+
(make-toplevel-set source var exp)))))
|
367
|
+
|
368
|
+
(define build-global-definition
|
369
|
+
(lambda (source var exp)
|
370
|
+
(maybe-name-value! var exp)
|
371
|
+
(make-toplevel-define source var exp)))
|
372
|
+
|
373
|
+
(define build-simple-lambda
|
374
|
+
(lambda (src req rest vars meta exp)
|
375
|
+
(make-lambda src
|
376
|
+
meta
|
377
|
+
;; hah, a case in which kwargs would be nice.
|
378
|
+
(make-lambda-case
|
379
|
+
;; src req opt rest kw inits vars body else
|
380
|
+
src req #f rest #f '() vars exp #f))))
|
381
|
+
|
382
|
+
(define build-case-lambda
|
383
|
+
(lambda (src meta body)
|
384
|
+
(make-lambda src meta body)))
|
385
|
+
|
386
|
+
(define build-lambda-case
|
387
|
+
;; req := (name ...)
|
388
|
+
;; opt := (name ...) | #f
|
389
|
+
;; rest := name | #f
|
390
|
+
;; kw := (allow-other-keys? (keyword name var) ...) | #f
|
391
|
+
;; inits: (init ...)
|
392
|
+
;; vars: (sym ...)
|
393
|
+
;; vars map to named arguments in the following order:
|
394
|
+
;; required, optional (positional), rest, keyword.
|
395
|
+
;; the body of a lambda: anything, already expanded
|
396
|
+
;; else: lambda-case | #f
|
397
|
+
(lambda (src req opt rest kw inits vars body else-case)
|
398
|
+
(make-lambda-case src req opt rest kw inits vars body else-case)))
|
399
|
+
|
400
|
+
(define build-primcall
|
401
|
+
(lambda (src name args)
|
402
|
+
(make-primcall src name args)))
|
403
|
+
|
404
|
+
(define build-primref
|
405
|
+
(lambda (src name)
|
406
|
+
(make-primitive-ref src name)))
|
407
|
+
|
408
|
+
(define (build-data src exp)
|
409
|
+
(make-const src exp))
|
410
|
+
|
411
|
+
(define build-sequence
|
412
|
+
(lambda (src exps)
|
413
|
+
(if (null? (cdr exps))
|
414
|
+
(car exps)
|
415
|
+
(make-seq src (car exps) (build-sequence #f (cdr exps))))))
|
416
|
+
|
417
|
+
(define build-let
|
418
|
+
(lambda (src ids vars val-exps body-exp)
|
419
|
+
(for-each maybe-name-value! ids val-exps)
|
420
|
+
(if (null? vars)
|
421
|
+
body-exp
|
422
|
+
(make-let src ids vars val-exps body-exp))))
|
423
|
+
|
424
|
+
(define build-named-let
|
425
|
+
(lambda (src ids vars val-exps body-exp)
|
426
|
+
(let ((f (car vars))
|
427
|
+
(f-name (car ids))
|
428
|
+
(vars (cdr vars))
|
429
|
+
(ids (cdr ids)))
|
430
|
+
(let ((proc (build-simple-lambda src ids #f vars '() body-exp)))
|
431
|
+
(maybe-name-value! f-name proc)
|
432
|
+
(for-each maybe-name-value! ids val-exps)
|
433
|
+
(make-letrec
|
434
|
+
src #f
|
435
|
+
(list f-name) (list f) (list proc)
|
436
|
+
(build-call src (build-lexical-reference 'fun src f-name f)
|
437
|
+
val-exps))))))
|
438
|
+
|
439
|
+
(define build-letrec
|
440
|
+
(lambda (src in-order? ids vars val-exps body-exp)
|
441
|
+
(if (null? vars)
|
442
|
+
body-exp
|
443
|
+
(begin
|
444
|
+
(for-each maybe-name-value! ids val-exps)
|
445
|
+
(make-letrec src in-order? ids vars val-exps body-exp)))))
|
446
|
+
|
447
|
+
|
448
|
+
(define-syntax-rule (build-lexical-var src id)
|
449
|
+
;; Use a per-module counter instead of the global counter of
|
450
|
+
;; 'gensym' so that the generated identifier is reproducible.
|
451
|
+
(module-gensym (symbol->string id)))
|
452
|
+
|
453
|
+
(define (syntax-object? x)
|
454
|
+
(or (syntax? x)
|
455
|
+
(and (allow-legacy-syntax-objects?)
|
456
|
+
(vector? x)
|
457
|
+
(= (vector-length x) 4)
|
458
|
+
(eqv? (vector-ref x 0) 'syntax-object))))
|
459
|
+
(define (make-syntax-object expression wrap module)
|
460
|
+
(make-syntax expression wrap module))
|
461
|
+
(define (syntax-object-expression obj)
|
462
|
+
(if (syntax? obj)
|
463
|
+
(syntax-expression obj)
|
464
|
+
(vector-ref obj 1)))
|
465
|
+
(define (syntax-object-wrap obj)
|
466
|
+
(if (syntax? obj)
|
467
|
+
(syntax-wrap obj)
|
468
|
+
(vector-ref obj 2)))
|
469
|
+
(define (syntax-object-module obj)
|
470
|
+
(if (syntax? obj)
|
471
|
+
(syntax-module obj)
|
472
|
+
(vector-ref obj 3)))
|
473
|
+
|
474
|
+
(define-syntax no-source (identifier-syntax #f))
|
475
|
+
|
476
|
+
(define source-annotation
|
477
|
+
(lambda (x)
|
478
|
+
(let ((props (source-properties
|
479
|
+
(if (syntax-object? x)
|
480
|
+
(syntax-object-expression x)
|
481
|
+
x))))
|
482
|
+
(and (pair? props) props))))
|
483
|
+
|
484
|
+
(define-syntax-rule (arg-check pred? e who)
|
485
|
+
(let ((x e))
|
486
|
+
(if (not (pred? x)) (syntax-violation who "invalid argument" x))))
|
487
|
+
|
488
|
+
;; compile-time environments
|
489
|
+
|
490
|
+
;; wrap and environment comprise two level mapping.
|
491
|
+
;; wrap : id --> label
|
492
|
+
;; env : label --> <element>
|
493
|
+
|
494
|
+
;; environments are represented in two parts: a lexical part and a
|
495
|
+
;; global part. The lexical part is a simple list of associations
|
496
|
+
;; from labels to bindings. The global part is implemented by
|
497
|
+
;; Guile's module system and associates symbols with bindings.
|
498
|
+
|
499
|
+
;; global (assumed global variable) and displaced-lexical (see below)
|
500
|
+
;; do not show up in any environment; instead, they are fabricated by
|
501
|
+
;; resolve-identifier when it finds no other bindings.
|
502
|
+
|
503
|
+
;; <environment> ::= ((<label> . <binding>)*)
|
504
|
+
|
505
|
+
;; identifier bindings include a type and a value
|
506
|
+
|
507
|
+
;; <binding> ::= (macro . <procedure>) macros
|
508
|
+
;; (syntax-parameter . <procedure>) syntax parameters
|
509
|
+
;; (core . <procedure>) core forms
|
510
|
+
;; (module-ref . <procedure>) @ or @@
|
511
|
+
;; (begin) begin
|
512
|
+
;; (define) define
|
513
|
+
;; (define-syntax) define-syntax
|
514
|
+
;; (define-syntax-parameter) define-syntax-parameter
|
515
|
+
;; (local-syntax . rec?) let-syntax/letrec-syntax
|
516
|
+
;; (eval-when) eval-when
|
517
|
+
;; (syntax . (<var> . <level>)) pattern variables
|
518
|
+
;; (global) assumed global variable
|
519
|
+
;; (lexical . <var>) lexical variables
|
520
|
+
;; (ellipsis . <identifier>) custom ellipsis
|
521
|
+
;; (displaced-lexical) displaced lexicals
|
522
|
+
;; <level> ::= <nonnegative integer>
|
523
|
+
;; <var> ::= variable returned by build-lexical-var
|
524
|
+
|
525
|
+
;; a macro is a user-defined syntactic-form. a core is a
|
526
|
+
;; system-defined syntactic form. begin, define, define-syntax,
|
527
|
+
;; define-syntax-parameter, and eval-when are treated specially
|
528
|
+
;; since they are sensitive to whether the form is at top-level and
|
529
|
+
;; (except for eval-when) can denote valid internal definitions.
|
530
|
+
|
531
|
+
;; a pattern variable is a variable introduced by syntax-case and can
|
532
|
+
;; be referenced only within a syntax form.
|
533
|
+
|
534
|
+
;; any identifier for which no top-level syntax definition or local
|
535
|
+
;; binding of any kind has been seen is assumed to be a global
|
536
|
+
;; variable.
|
537
|
+
|
538
|
+
;; a lexical variable is a lambda- or letrec-bound variable.
|
539
|
+
|
540
|
+
;; an ellipsis binding is introduced by the 'with-ellipsis' special
|
541
|
+
;; form.
|
542
|
+
|
543
|
+
;; a displaced-lexical identifier is a lexical identifier removed from
|
544
|
+
;; it's scope by the return of a syntax object containing the identifier.
|
545
|
+
;; a displaced lexical can also appear when a letrec-syntax-bound
|
546
|
+
;; keyword is referenced on the rhs of one of the letrec-syntax clauses.
|
547
|
+
;; a displaced lexical should never occur with properly written macros.
|
548
|
+
|
549
|
+
(define-syntax make-binding
|
550
|
+
(syntax-rules (quote)
|
551
|
+
((_ type value) (cons type value))
|
552
|
+
((_ 'type) '(type))
|
553
|
+
((_ type) (cons type '()))))
|
554
|
+
(define-syntax-rule (binding-type x)
|
555
|
+
(car x))
|
556
|
+
(define-syntax-rule (binding-value x)
|
557
|
+
(cdr x))
|
558
|
+
|
559
|
+
(define-syntax null-env (identifier-syntax '()))
|
560
|
+
|
561
|
+
(define extend-env
|
562
|
+
(lambda (labels bindings r)
|
563
|
+
(if (null? labels)
|
564
|
+
r
|
565
|
+
(extend-env (cdr labels) (cdr bindings)
|
566
|
+
(cons (cons (car labels) (car bindings)) r)))))
|
567
|
+
|
568
|
+
(define extend-var-env
|
569
|
+
;; variant of extend-env that forms "lexical" binding
|
570
|
+
(lambda (labels vars r)
|
571
|
+
(if (null? labels)
|
572
|
+
r
|
573
|
+
(extend-var-env (cdr labels) (cdr vars)
|
574
|
+
(cons (cons (car labels) (make-binding 'lexical (car vars))) r)))))
|
575
|
+
|
576
|
+
;; we use a "macros only" environment in expansion of local macro
|
577
|
+
;; definitions so that their definitions can use local macros without
|
578
|
+
;; attempting to use other lexical identifiers.
|
579
|
+
(define macros-only-env
|
580
|
+
(lambda (r)
|
581
|
+
(if (null? r)
|
582
|
+
'()
|
583
|
+
(let ((a (car r)))
|
584
|
+
(if (memq (cadr a) '(macro syntax-parameter ellipsis))
|
585
|
+
(cons a (macros-only-env (cdr r)))
|
586
|
+
(macros-only-env (cdr r)))))))
|
587
|
+
|
588
|
+
(define global-extend
|
589
|
+
(lambda (type sym val)
|
590
|
+
(module-define! (current-module)
|
591
|
+
sym
|
592
|
+
(make-syntax-transformer sym type val))))
|
593
|
+
|
594
|
+
|
595
|
+
;; Conceptually, identifiers are always syntax objects. Internally,
|
596
|
+
;; however, the wrap is sometimes maintained separately (a source of
|
597
|
+
;; efficiency and confusion), so that symbols are also considered
|
598
|
+
;; identifiers by id?. Externally, they are always wrapped.
|
599
|
+
|
600
|
+
(define nonsymbol-id?
|
601
|
+
(lambda (x)
|
602
|
+
(and (syntax-object? x)
|
603
|
+
(symbol? (syntax-object-expression x)))))
|
604
|
+
|
605
|
+
(define id?
|
606
|
+
(lambda (x)
|
607
|
+
(cond
|
608
|
+
((symbol? x) #t)
|
609
|
+
((syntax-object? x) (symbol? (syntax-object-expression x)))
|
610
|
+
(else #f))))
|
611
|
+
|
612
|
+
(define-syntax-rule (id-sym-name e)
|
613
|
+
(let ((x e))
|
614
|
+
(if (syntax-object? x)
|
615
|
+
(syntax-object-expression x)
|
616
|
+
x)))
|
617
|
+
|
618
|
+
(define id-sym-name&marks
|
619
|
+
(lambda (x w)
|
620
|
+
(if (syntax-object? x)
|
621
|
+
(values
|
622
|
+
(syntax-object-expression x)
|
623
|
+
(join-marks (wrap-marks w) (wrap-marks (syntax-object-wrap x))))
|
624
|
+
(values x (wrap-marks w)))))
|
625
|
+
|
626
|
+
;; syntax object wraps
|
627
|
+
|
628
|
+
;; <wrap> ::= ((<mark> ...) . (<subst> ...))
|
629
|
+
;; <subst> ::= shift | <subs>
|
630
|
+
;; <subs> ::= #(ribcage #(<sym> ...) #(<mark> ...) #(<label> ...))
|
631
|
+
;; | #(ribcage (<sym> ...) (<mark> ...) (<label> ...))
|
632
|
+
|
633
|
+
(define-syntax make-wrap (identifier-syntax cons))
|
634
|
+
(define-syntax wrap-marks (identifier-syntax car))
|
635
|
+
(define-syntax wrap-subst (identifier-syntax cdr))
|
636
|
+
|
637
|
+
;; labels must be comparable with "eq?", have read-write invariance,
|
638
|
+
;; and distinct from symbols.
|
639
|
+
(define (gen-label)
|
640
|
+
(symbol->string (module-gensym "l")))
|
641
|
+
|
642
|
+
(define gen-labels
|
643
|
+
(lambda (ls)
|
644
|
+
(if (null? ls)
|
645
|
+
'()
|
646
|
+
(cons (gen-label) (gen-labels (cdr ls))))))
|
647
|
+
|
648
|
+
(define-structure (ribcage symnames marks labels))
|
649
|
+
|
650
|
+
(define-syntax empty-wrap (identifier-syntax '(())))
|
651
|
+
|
652
|
+
(define-syntax top-wrap (identifier-syntax '((top))))
|
653
|
+
|
654
|
+
(define-syntax-rule (top-marked? w)
|
655
|
+
(memq 'top (wrap-marks w)))
|
656
|
+
|
657
|
+
;; Marks must be comparable with "eq?" and distinct from pairs and
|
658
|
+
;; the symbol top. We do not use integers so that marks will remain
|
659
|
+
;; unique even across file compiles.
|
660
|
+
|
661
|
+
(define-syntax the-anti-mark (identifier-syntax #f))
|
662
|
+
|
663
|
+
(define anti-mark
|
664
|
+
(lambda (w)
|
665
|
+
(make-wrap (cons the-anti-mark (wrap-marks w))
|
666
|
+
(cons 'shift (wrap-subst w)))))
|
667
|
+
|
668
|
+
(define-syntax-rule (new-mark)
|
669
|
+
(module-gensym "m"))
|
670
|
+
|
671
|
+
;; make-empty-ribcage and extend-ribcage maintain list-based ribcages for
|
672
|
+
;; internal definitions, in which the ribcages are built incrementally
|
673
|
+
(define-syntax-rule (make-empty-ribcage)
|
674
|
+
(make-ribcage '() '() '()))
|
675
|
+
|
676
|
+
(define extend-ribcage!
|
677
|
+
;; must receive ids with complete wraps
|
678
|
+
(lambda (ribcage id label)
|
679
|
+
(set-ribcage-symnames! ribcage
|
680
|
+
(cons (syntax-object-expression id)
|
681
|
+
(ribcage-symnames ribcage)))
|
682
|
+
(set-ribcage-marks! ribcage
|
683
|
+
(cons (wrap-marks (syntax-object-wrap id))
|
684
|
+
(ribcage-marks ribcage)))
|
685
|
+
(set-ribcage-labels! ribcage
|
686
|
+
(cons label (ribcage-labels ribcage)))))
|
687
|
+
|
688
|
+
;; make-binding-wrap creates vector-based ribcages
|
689
|
+
(define make-binding-wrap
|
690
|
+
(lambda (ids labels w)
|
691
|
+
(if (null? ids)
|
692
|
+
w
|
693
|
+
(make-wrap
|
694
|
+
(wrap-marks w)
|
695
|
+
(cons
|
696
|
+
(let ((labelvec (list->vector labels)))
|
697
|
+
(let ((n (vector-length labelvec)))
|
698
|
+
(let ((symnamevec (make-vector n)) (marksvec (make-vector n)))
|
699
|
+
(let f ((ids ids) (i 0))
|
700
|
+
(if (not (null? ids))
|
701
|
+
(call-with-values
|
702
|
+
(lambda () (id-sym-name&marks (car ids) w))
|
703
|
+
(lambda (symname marks)
|
704
|
+
(vector-set! symnamevec i symname)
|
705
|
+
(vector-set! marksvec i marks)
|
706
|
+
(f (cdr ids) (fx+ i 1))))))
|
707
|
+
(make-ribcage symnamevec marksvec labelvec))))
|
708
|
+
(wrap-subst w))))))
|
709
|
+
|
710
|
+
(define smart-append
|
711
|
+
(lambda (m1 m2)
|
712
|
+
(if (null? m2)
|
713
|
+
m1
|
714
|
+
(append m1 m2))))
|
715
|
+
|
716
|
+
(define join-wraps
|
717
|
+
(lambda (w1 w2)
|
718
|
+
(let ((m1 (wrap-marks w1)) (s1 (wrap-subst w1)))
|
719
|
+
(if (null? m1)
|
720
|
+
(if (null? s1)
|
721
|
+
w2
|
722
|
+
(make-wrap
|
723
|
+
(wrap-marks w2)
|
724
|
+
(smart-append s1 (wrap-subst w2))))
|
725
|
+
(make-wrap
|
726
|
+
(smart-append m1 (wrap-marks w2))
|
727
|
+
(smart-append s1 (wrap-subst w2)))))))
|
728
|
+
|
729
|
+
(define join-marks
|
730
|
+
(lambda (m1 m2)
|
731
|
+
(smart-append m1 m2)))
|
732
|
+
|
733
|
+
(define same-marks?
|
734
|
+
(lambda (x y)
|
735
|
+
(or (eq? x y)
|
736
|
+
(and (not (null? x))
|
737
|
+
(not (null? y))
|
738
|
+
(eq? (car x) (car y))
|
739
|
+
(same-marks? (cdr x) (cdr y))))))
|
740
|
+
|
741
|
+
(define id-var-name
|
742
|
+
;; Syntax objects use wraps to associate names with marked
|
743
|
+
;; identifiers. This function returns the name corresponding to
|
744
|
+
;; the given identifier and wrap, or the original identifier if no
|
745
|
+
;; corresponding name was found.
|
746
|
+
;;
|
747
|
+
;; The name may be a string created by gen-label, indicating a
|
748
|
+
;; lexical binding, or another syntax object, indicating a
|
749
|
+
;; reference to a top-level definition created during a previous
|
750
|
+
;; macroexpansion.
|
751
|
+
;;
|
752
|
+
;; For lexical variables, finding a label simply amounts to
|
753
|
+
;; looking for an entry with the same symbolic name and the same
|
754
|
+
;; marks. Finding a toplevel definition is the same, except we
|
755
|
+
;; also have to compare modules, hence the `mod' parameter.
|
756
|
+
;; Instead of adding a separate entry in the ribcage for modules,
|
757
|
+
;; which wouldn't be used for lexicals, we arrange for the entry
|
758
|
+
;; for the name entry to be a pair with the module in its car, and
|
759
|
+
;; the name itself in the cdr. So if the name that we find is a
|
760
|
+
;; pair, we have to check modules.
|
761
|
+
;;
|
762
|
+
;; The identifer may be passed in wrapped or unwrapped. In any
|
763
|
+
;; case, this routine returns either a symbol, a syntax object, or
|
764
|
+
;; a string label.
|
765
|
+
;;
|
766
|
+
(lambda (id w mod)
|
767
|
+
(define-syntax-rule (first e)
|
768
|
+
;; Rely on Guile's multiple-values truncation.
|
769
|
+
e)
|
770
|
+
(define search
|
771
|
+
(lambda (sym subst marks mod)
|
772
|
+
(if (null? subst)
|
773
|
+
(values #f marks)
|
774
|
+
(let ((fst (car subst)))
|
775
|
+
(if (eq? fst 'shift)
|
776
|
+
(search sym (cdr subst) (cdr marks) mod)
|
777
|
+
(let ((symnames (ribcage-symnames fst)))
|
778
|
+
(if (vector? symnames)
|
779
|
+
(search-vector-rib sym subst marks symnames fst mod)
|
780
|
+
(search-list-rib sym subst marks symnames fst mod))))))))
|
781
|
+
(define search-list-rib
|
782
|
+
(lambda (sym subst marks symnames ribcage mod)
|
783
|
+
(let f ((symnames symnames) (i 0))
|
784
|
+
(cond
|
785
|
+
((null? symnames) (search sym (cdr subst) marks mod))
|
786
|
+
((and (eq? (car symnames) sym)
|
787
|
+
(same-marks? marks (list-ref (ribcage-marks ribcage) i)))
|
788
|
+
(let ((n (list-ref (ribcage-labels ribcage) i)))
|
789
|
+
(if (pair? n)
|
790
|
+
(if (equal? mod (car n))
|
791
|
+
(values (cdr n) marks)
|
792
|
+
(f (cdr symnames) (fx+ i 1)))
|
793
|
+
(values n marks))))
|
794
|
+
(else (f (cdr symnames) (fx+ i 1)))))))
|
795
|
+
(define search-vector-rib
|
796
|
+
(lambda (sym subst marks symnames ribcage mod)
|
797
|
+
(let ((n (vector-length symnames)))
|
798
|
+
(let f ((i 0))
|
799
|
+
(cond
|
800
|
+
((fx= i n) (search sym (cdr subst) marks mod))
|
801
|
+
((and (eq? (vector-ref symnames i) sym)
|
802
|
+
(same-marks? marks (vector-ref (ribcage-marks ribcage) i)))
|
803
|
+
(let ((n (vector-ref (ribcage-labels ribcage) i)))
|
804
|
+
(if (pair? n)
|
805
|
+
(if (equal? mod (car n))
|
806
|
+
(values (cdr n) marks)
|
807
|
+
(f (fx+ i 1)))
|
808
|
+
(values n marks))))
|
809
|
+
(else (f (fx+ i 1))))))))
|
810
|
+
(cond
|
811
|
+
((symbol? id)
|
812
|
+
(or (first (search id (wrap-subst w) (wrap-marks w) mod)) id))
|
813
|
+
((syntax-object? id)
|
814
|
+
(let ((id (syntax-object-expression id))
|
815
|
+
(w1 (syntax-object-wrap id))
|
816
|
+
(mod (syntax-object-module id)))
|
817
|
+
(let ((marks (join-marks (wrap-marks w) (wrap-marks w1))))
|
818
|
+
(call-with-values (lambda () (search id (wrap-subst w) marks mod))
|
819
|
+
(lambda (new-id marks)
|
820
|
+
(or new-id
|
821
|
+
(first (search id (wrap-subst w1) marks mod))
|
822
|
+
id))))))
|
823
|
+
(else (syntax-violation 'id-var-name "invalid id" id)))))
|
824
|
+
|
825
|
+
;; A helper procedure for syntax-locally-bound-identifiers, which
|
826
|
+
;; itself is a helper for transformer procedures.
|
827
|
+
;; `locally-bound-identifiers' returns a list of all bindings
|
828
|
+
;; visible to a syntax object with the given wrap. They are in
|
829
|
+
;; order from outer to inner.
|
830
|
+
;;
|
831
|
+
;; The purpose of this procedure is to give a transformer procedure
|
832
|
+
;; references on bound identifiers, that the transformer can then
|
833
|
+
;; introduce some of them in its output. As such, the identifiers
|
834
|
+
;; are anti-marked, so that rebuild-macro-output doesn't apply new
|
835
|
+
;; marks to them.
|
836
|
+
;;
|
837
|
+
(define locally-bound-identifiers
|
838
|
+
(lambda (w mod)
|
839
|
+
(define scan
|
840
|
+
(lambda (subst results)
|
841
|
+
(if (null? subst)
|
842
|
+
results
|
843
|
+
(let ((fst (car subst)))
|
844
|
+
(if (eq? fst 'shift)
|
845
|
+
(scan (cdr subst) results)
|
846
|
+
(let ((symnames (ribcage-symnames fst))
|
847
|
+
(marks (ribcage-marks fst)))
|
848
|
+
(if (vector? symnames)
|
849
|
+
(scan-vector-rib subst symnames marks results)
|
850
|
+
(scan-list-rib subst symnames marks results))))))))
|
851
|
+
(define scan-list-rib
|
852
|
+
(lambda (subst symnames marks results)
|
853
|
+
(let f ((symnames symnames) (marks marks) (results results))
|
854
|
+
(if (null? symnames)
|
855
|
+
(scan (cdr subst) results)
|
856
|
+
(f (cdr symnames) (cdr marks)
|
857
|
+
(cons (wrap (car symnames)
|
858
|
+
(anti-mark (make-wrap (car marks) subst))
|
859
|
+
mod)
|
860
|
+
results))))))
|
861
|
+
(define scan-vector-rib
|
862
|
+
(lambda (subst symnames marks results)
|
863
|
+
(let ((n (vector-length symnames)))
|
864
|
+
(let f ((i 0) (results results))
|
865
|
+
(if (fx= i n)
|
866
|
+
(scan (cdr subst) results)
|
867
|
+
(f (fx+ i 1)
|
868
|
+
(cons (wrap (vector-ref symnames i)
|
869
|
+
(anti-mark (make-wrap (vector-ref marks i) subst))
|
870
|
+
mod)
|
871
|
+
results)))))))
|
872
|
+
(scan (wrap-subst w) '())))
|
873
|
+
|
874
|
+
;; Returns three values: binding type, binding value, and the module
|
875
|
+
;; (for resolving toplevel vars).
|
876
|
+
(define (resolve-identifier id w r mod resolve-syntax-parameters?)
|
877
|
+
(define (resolve-global var mod)
|
878
|
+
(when (and (not mod) (current-module))
|
879
|
+
(warn "module system is booted, we should have a module" var))
|
880
|
+
(let ((v (and (not (equal? mod '(primitive)))
|
881
|
+
(module-variable (if mod
|
882
|
+
(resolve-module (cdr mod))
|
883
|
+
(current-module))
|
884
|
+
var))))
|
885
|
+
;; The expander needs to know when a top-level definition from
|
886
|
+
;; outside the compilation unit is a macro.
|
887
|
+
;;
|
888
|
+
;; Additionally if a macro is actually a syntax-parameter, we
|
889
|
+
;; might need to resolve its current binding. If the syntax
|
890
|
+
;; parameter is locally bound (via syntax-parameterize), then
|
891
|
+
;; its variable will be present in `r', the expand-time
|
892
|
+
;; environment. It's a kind of double lookup: first we see
|
893
|
+
;; that a name is bound to a syntax parameter, then we look
|
894
|
+
;; for the current binding of the syntax parameter.
|
895
|
+
;;
|
896
|
+
;; We use the variable (box) holding the syntax parameter
|
897
|
+
;; definition as the key for the second lookup. We use the
|
898
|
+
;; variable for two reasons:
|
899
|
+
;;
|
900
|
+
;; 1. If the syntax parameter is redefined in parallel
|
901
|
+
;; (perhaps via a parallel module compilation), the
|
902
|
+
;; redefinition keeps the same variable. We don't want to
|
903
|
+
;; use a "key" that could change during a redefinition. See
|
904
|
+
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27476.
|
905
|
+
;;
|
906
|
+
;; 2. Using the variable instead of its (symname, modname)
|
907
|
+
;; pair allows for syntax parameters to be renamed or
|
908
|
+
;; aliased while preserving the syntax parameter's identity.
|
909
|
+
;;
|
910
|
+
(if (and v (variable-bound? v) (macro? (variable-ref v)))
|
911
|
+
(let* ((m (variable-ref v))
|
912
|
+
(type (macro-type m))
|
913
|
+
(trans (macro-binding m))
|
914
|
+
(trans (if (pair? trans) (car trans) trans)))
|
915
|
+
(if (eq? type 'syntax-parameter)
|
916
|
+
(if resolve-syntax-parameters?
|
917
|
+
(let ((lexical (assq-ref r v)))
|
918
|
+
;; A resolved syntax parameter is
|
919
|
+
;; indistinguishable from a macro.
|
920
|
+
(values 'macro
|
921
|
+
(if lexical
|
922
|
+
(binding-value lexical)
|
923
|
+
trans)
|
924
|
+
mod))
|
925
|
+
;; Return box as value for use in second lookup.
|
926
|
+
(values type v mod))
|
927
|
+
(values type trans mod)))
|
928
|
+
(values 'global var mod))))
|
929
|
+
(define (resolve-lexical label mod)
|
930
|
+
(let ((b (assq-ref r label)))
|
931
|
+
(if b
|
932
|
+
(let ((type (binding-type b))
|
933
|
+
(value (binding-value b)))
|
934
|
+
(if (eq? type 'syntax-parameter)
|
935
|
+
(if resolve-syntax-parameters?
|
936
|
+
(values 'macro value mod)
|
937
|
+
;; If the syntax parameter was defined within
|
938
|
+
;; this compilation unit, use its label as its
|
939
|
+
;; lookup key.
|
940
|
+
(values type label mod))
|
941
|
+
(values type value mod)))
|
942
|
+
(values 'displaced-lexical #f #f))))
|
943
|
+
(let ((n (id-var-name id w mod)))
|
944
|
+
(cond
|
945
|
+
((syntax-object? n)
|
946
|
+
(cond
|
947
|
+
((not (eq? n id))
|
948
|
+
;; This identifier aliased another; recurse to allow
|
949
|
+
;; syntax-parameterize to override macro-introduced syntax
|
950
|
+
;; parameters.
|
951
|
+
(resolve-identifier n w r mod resolve-syntax-parameters?))
|
952
|
+
(else
|
953
|
+
;; Resolved to a free variable that was introduced by this
|
954
|
+
;; macro; continue to resolve this global by name.
|
955
|
+
(resolve-identifier (syntax-object-expression n)
|
956
|
+
(syntax-object-wrap n)
|
957
|
+
r
|
958
|
+
(syntax-object-module n)
|
959
|
+
resolve-syntax-parameters?))))
|
960
|
+
((symbol? n)
|
961
|
+
(resolve-global n (if (syntax-object? id)
|
962
|
+
(syntax-object-module id)
|
963
|
+
mod)))
|
964
|
+
((string? n)
|
965
|
+
(resolve-lexical n (if (syntax-object? id)
|
966
|
+
(syntax-object-module id)
|
967
|
+
mod)))
|
968
|
+
(else
|
969
|
+
(error "unexpected id-var-name" id w n)))))
|
970
|
+
|
971
|
+
(define transformer-environment
|
972
|
+
(make-fluid
|
973
|
+
(lambda (k)
|
974
|
+
(error "called outside the dynamic extent of a syntax transformer"))))
|
975
|
+
|
976
|
+
(define (with-transformer-environment k)
|
977
|
+
((fluid-ref transformer-environment) k))
|
978
|
+
|
979
|
+
;; free-id=? must be passed fully wrapped ids since (free-id=? x y)
|
980
|
+
;; may be true even if (free-id=? (wrap x w) (wrap y w)) is not.
|
981
|
+
|
982
|
+
(define free-id=?
|
983
|
+
(lambda (i j)
|
984
|
+
(let* ((mi (and (syntax-object? i) (syntax-object-module i)))
|
985
|
+
(mj (and (syntax-object? j) (syntax-object-module j)))
|
986
|
+
(ni (id-var-name i empty-wrap mi))
|
987
|
+
(nj (id-var-name j empty-wrap mj)))
|
988
|
+
(define (id-module-binding id mod)
|
989
|
+
(module-variable
|
990
|
+
(if mod
|
991
|
+
;; The normal case.
|
992
|
+
(resolve-module (cdr mod))
|
993
|
+
;; Either modules have not been booted, or we have a
|
994
|
+
;; raw symbol coming in, which is possible.
|
995
|
+
(current-module))
|
996
|
+
(id-sym-name id)))
|
997
|
+
(cond
|
998
|
+
((syntax-object? ni) (free-id=? ni j))
|
999
|
+
((syntax-object? nj) (free-id=? i nj))
|
1000
|
+
((symbol? ni)
|
1001
|
+
;; `i' is not lexically bound. Assert that `j' is free,
|
1002
|
+
;; and if so, compare their bindings, that they are either
|
1003
|
+
;; bound to the same variable, or both unbound and have
|
1004
|
+
;; the same name.
|
1005
|
+
(and (eq? nj (id-sym-name j))
|
1006
|
+
(let ((bi (id-module-binding i mi)))
|
1007
|
+
(if bi
|
1008
|
+
(eq? bi (id-module-binding j mj))
|
1009
|
+
(and (not (id-module-binding j mj))
|
1010
|
+
(eq? ni nj))))
|
1011
|
+
(eq? (id-module-binding i mi) (id-module-binding j mj))))
|
1012
|
+
(else
|
1013
|
+
;; Otherwise `i' is bound, so check that `j' is bound, and
|
1014
|
+
;; bound to the same thing.
|
1015
|
+
(equal? ni nj))))))
|
1016
|
+
|
1017
|
+
;; bound-id=? may be passed unwrapped (or partially wrapped) ids as
|
1018
|
+
;; long as the missing portion of the wrap is common to both of the ids
|
1019
|
+
;; since (bound-id=? x y) iff (bound-id=? (wrap x w) (wrap y w))
|
1020
|
+
|
1021
|
+
(define bound-id=?
|
1022
|
+
(lambda (i j)
|
1023
|
+
(if (and (syntax-object? i) (syntax-object? j))
|
1024
|
+
(and (eq? (syntax-object-expression i)
|
1025
|
+
(syntax-object-expression j))
|
1026
|
+
(same-marks? (wrap-marks (syntax-object-wrap i))
|
1027
|
+
(wrap-marks (syntax-object-wrap j))))
|
1028
|
+
(eq? i j))))
|
1029
|
+
|
1030
|
+
;; "valid-bound-ids?" returns #t if it receives a list of distinct ids.
|
1031
|
+
;; valid-bound-ids? may be passed unwrapped (or partially wrapped) ids
|
1032
|
+
;; as long as the missing portion of the wrap is common to all of the
|
1033
|
+
;; ids.
|
1034
|
+
|
1035
|
+
(define valid-bound-ids?
|
1036
|
+
(lambda (ids)
|
1037
|
+
(and (let all-ids? ((ids ids))
|
1038
|
+
(or (null? ids)
|
1039
|
+
(and (id? (car ids))
|
1040
|
+
(all-ids? (cdr ids)))))
|
1041
|
+
(distinct-bound-ids? ids))))
|
1042
|
+
|
1043
|
+
;; distinct-bound-ids? expects a list of ids and returns #t if there are
|
1044
|
+
;; no duplicates. It is quadratic on the length of the id list; long
|
1045
|
+
;; lists could be sorted to make it more efficient. distinct-bound-ids?
|
1046
|
+
;; may be passed unwrapped (or partially wrapped) ids as long as the
|
1047
|
+
;; missing portion of the wrap is common to all of the ids.
|
1048
|
+
|
1049
|
+
(define distinct-bound-ids?
|
1050
|
+
(lambda (ids)
|
1051
|
+
(let distinct? ((ids ids))
|
1052
|
+
(or (null? ids)
|
1053
|
+
(and (not (bound-id-member? (car ids) (cdr ids)))
|
1054
|
+
(distinct? (cdr ids)))))))
|
1055
|
+
|
1056
|
+
(define bound-id-member?
|
1057
|
+
(lambda (x list)
|
1058
|
+
(and (not (null? list))
|
1059
|
+
(or (bound-id=? x (car list))
|
1060
|
+
(bound-id-member? x (cdr list))))))
|
1061
|
+
|
1062
|
+
;; wrapping expressions and identifiers
|
1063
|
+
|
1064
|
+
(define wrap
|
1065
|
+
(lambda (x w defmod)
|
1066
|
+
(cond
|
1067
|
+
((and (null? (wrap-marks w)) (null? (wrap-subst w))) x)
|
1068
|
+
((syntax-object? x)
|
1069
|
+
(make-syntax-object
|
1070
|
+
(syntax-object-expression x)
|
1071
|
+
(join-wraps w (syntax-object-wrap x))
|
1072
|
+
(syntax-object-module x)))
|
1073
|
+
((null? x) x)
|
1074
|
+
(else (make-syntax-object x w defmod)))))
|
1075
|
+
|
1076
|
+
(define source-wrap
|
1077
|
+
(lambda (x w s defmod)
|
1078
|
+
(wrap (decorate-source x s) w defmod)))
|
1079
|
+
|
1080
|
+
;; expanding
|
1081
|
+
|
1082
|
+
(define expand-sequence
|
1083
|
+
(lambda (body r w s mod)
|
1084
|
+
(build-sequence s
|
1085
|
+
(let dobody ((body body) (r r) (w w) (mod mod))
|
1086
|
+
(if (null? body)
|
1087
|
+
'()
|
1088
|
+
(let ((first (expand (car body) r w mod)))
|
1089
|
+
(cons first (dobody (cdr body) r w mod))))))))
|
1090
|
+
|
1091
|
+
;; At top-level, we allow mixed definitions and expressions. Like
|
1092
|
+
;; expand-body we expand in two passes.
|
1093
|
+
;;
|
1094
|
+
;; First, from left to right, we expand just enough to know what
|
1095
|
+
;; expressions are definitions, syntax definitions, and splicing
|
1096
|
+
;; statements (`begin'). If we anything needs evaluating at
|
1097
|
+
;; expansion-time, it is expanded directly.
|
1098
|
+
;;
|
1099
|
+
;; Otherwise we collect expressions to expand, in thunks, and then
|
1100
|
+
;; expand them all at the end. This allows all syntax expanders
|
1101
|
+
;; visible in a toplevel sequence to be visible during the
|
1102
|
+
;; expansions of all normal definitions and expressions in the
|
1103
|
+
;; sequence.
|
1104
|
+
;;
|
1105
|
+
(define expand-top-sequence
|
1106
|
+
(lambda (body r w s m esew mod)
|
1107
|
+
(let* ((r (cons '("placeholder" . (placeholder)) r))
|
1108
|
+
(ribcage (make-empty-ribcage))
|
1109
|
+
(w (make-wrap (wrap-marks w) (cons ribcage (wrap-subst w)))))
|
1110
|
+
(define (record-definition! id var)
|
1111
|
+
(let ((mod (cons 'hygiene (module-name (current-module)))))
|
1112
|
+
;; Ribcages map symbol+marks to names, mostly for
|
1113
|
+
;; resolving lexicals. Here to add a mapping for toplevel
|
1114
|
+
;; definitions we also need to match the module. So, we
|
1115
|
+
;; put it in the name instead, and make id-var-name handle
|
1116
|
+
;; the special case of names that are pairs. See the
|
1117
|
+
;; comments in id-var-name for more.
|
1118
|
+
(extend-ribcage! ribcage id
|
1119
|
+
(cons (syntax-object-module id)
|
1120
|
+
(wrap var top-wrap mod)))))
|
1121
|
+
(define (macro-introduced-identifier? id)
|
1122
|
+
(not (equal? (wrap-marks (syntax-object-wrap id)) '(top))))
|
1123
|
+
(define (fresh-derived-name id orig-form)
|
1124
|
+
(symbol-append
|
1125
|
+
(syntax-object-expression id)
|
1126
|
+
'-
|
1127
|
+
(string->symbol
|
1128
|
+
;; FIXME: `hash' currently stops descending into nested
|
1129
|
+
;; data at some point, so it's less unique than we would
|
1130
|
+
;; like. Also this encodes hash values into the ABI of
|
1131
|
+
;; compiled modules; a problem?
|
1132
|
+
(number->string
|
1133
|
+
(hash (syntax->datum orig-form) most-positive-fixnum)
|
1134
|
+
16))))
|
1135
|
+
(define (parse body r w s m esew mod)
|
1136
|
+
(let lp ((body body) (exps '()))
|
1137
|
+
(if (null? body)
|
1138
|
+
exps
|
1139
|
+
(lp (cdr body)
|
1140
|
+
(append (parse1 (car body) r w s m esew mod)
|
1141
|
+
exps)))))
|
1142
|
+
(define (parse1 x r w s m esew mod)
|
1143
|
+
(define (current-module-for-expansion mod)
|
1144
|
+
(case (car mod)
|
1145
|
+
;; If the module was just put in place for hygiene, in a
|
1146
|
+
;; top-level `begin' always recapture the current
|
1147
|
+
;; module. If a user wants to override, then we need to
|
1148
|
+
;; use @@ or similar.
|
1149
|
+
((hygiene) (cons 'hygiene (module-name (current-module))))
|
1150
|
+
(else mod)))
|
1151
|
+
(call-with-values
|
1152
|
+
(lambda ()
|
1153
|
+
(let ((mod (current-module-for-expansion mod)))
|
1154
|
+
(syntax-type x r w (source-annotation x) ribcage mod #f)))
|
1155
|
+
(lambda (type value form e w s mod)
|
1156
|
+
(case type
|
1157
|
+
((define-form)
|
1158
|
+
(let* ((id (wrap value w mod))
|
1159
|
+
(label (gen-label))
|
1160
|
+
(var (if (macro-introduced-identifier? id)
|
1161
|
+
(fresh-derived-name id x)
|
1162
|
+
(syntax-object-expression id))))
|
1163
|
+
(record-definition! id var)
|
1164
|
+
(list
|
1165
|
+
(if (eq? m 'c&e)
|
1166
|
+
(let ((x (build-global-definition s var (expand e r w mod))))
|
1167
|
+
(top-level-eval-hook x mod)
|
1168
|
+
(lambda () x))
|
1169
|
+
(call-with-values
|
1170
|
+
(lambda () (resolve-identifier id empty-wrap r mod #t))
|
1171
|
+
(lambda (type* value* mod*)
|
1172
|
+
;; If the identifier to be bound is currently bound to a
|
1173
|
+
;; macro, then immediately discard that binding.
|
1174
|
+
(if (eq? type* 'macro)
|
1175
|
+
(top-level-eval-hook (build-global-definition
|
1176
|
+
s var (build-void s))
|
1177
|
+
mod))
|
1178
|
+
(lambda ()
|
1179
|
+
(build-global-definition s var (expand e r w mod)))))))))
|
1180
|
+
((define-syntax-form define-syntax-parameter-form)
|
1181
|
+
(let* ((id (wrap value w mod))
|
1182
|
+
(label (gen-label))
|
1183
|
+
(var (if (macro-introduced-identifier? id)
|
1184
|
+
(fresh-derived-name id x)
|
1185
|
+
(syntax-object-expression id))))
|
1186
|
+
(record-definition! id var)
|
1187
|
+
(case m
|
1188
|
+
((c)
|
1189
|
+
(cond
|
1190
|
+
((memq 'compile esew)
|
1191
|
+
(let ((e (expand-install-global var type (expand e r w mod))))
|
1192
|
+
(top-level-eval-hook e mod)
|
1193
|
+
(if (memq 'load esew)
|
1194
|
+
(list (lambda () e))
|
1195
|
+
'())))
|
1196
|
+
((memq 'load esew)
|
1197
|
+
(list (lambda ()
|
1198
|
+
(expand-install-global var type (expand e r w mod)))))
|
1199
|
+
(else '())))
|
1200
|
+
((c&e)
|
1201
|
+
(let ((e (expand-install-global var type (expand e r w mod))))
|
1202
|
+
(top-level-eval-hook e mod)
|
1203
|
+
(list (lambda () e))))
|
1204
|
+
(else
|
1205
|
+
(if (memq 'eval esew)
|
1206
|
+
(top-level-eval-hook
|
1207
|
+
(expand-install-global var type (expand e r w mod))
|
1208
|
+
mod))
|
1209
|
+
'()))))
|
1210
|
+
((begin-form)
|
1211
|
+
(syntax-case e ()
|
1212
|
+
((_ e1 ...)
|
1213
|
+
(parse #'(e1 ...) r w s m esew mod))))
|
1214
|
+
((local-syntax-form)
|
1215
|
+
(expand-local-syntax value e r w s mod
|
1216
|
+
(lambda (forms r w s mod)
|
1217
|
+
(parse forms r w s m esew mod))))
|
1218
|
+
((eval-when-form)
|
1219
|
+
(syntax-case e ()
|
1220
|
+
((_ (x ...) e1 e2 ...)
|
1221
|
+
(let ((when-list (parse-when-list e #'(x ...)))
|
1222
|
+
(body #'(e1 e2 ...)))
|
1223
|
+
(define (recurse m esew)
|
1224
|
+
(parse body r w s m esew mod))
|
1225
|
+
(cond
|
1226
|
+
((eq? m 'e)
|
1227
|
+
(if (memq 'eval when-list)
|
1228
|
+
(recurse (if (memq 'expand when-list) 'c&e 'e)
|
1229
|
+
'(eval))
|
1230
|
+
(begin
|
1231
|
+
(if (memq 'expand when-list)
|
1232
|
+
(top-level-eval-hook
|
1233
|
+
(expand-top-sequence body r w s 'e '(eval) mod)
|
1234
|
+
mod))
|
1235
|
+
'())))
|
1236
|
+
((memq 'load when-list)
|
1237
|
+
(if (or (memq 'compile when-list)
|
1238
|
+
(memq 'expand when-list)
|
1239
|
+
(and (eq? m 'c&e) (memq 'eval when-list)))
|
1240
|
+
(recurse 'c&e '(compile load))
|
1241
|
+
(if (memq m '(c c&e))
|
1242
|
+
(recurse 'c '(load))
|
1243
|
+
'())))
|
1244
|
+
((or (memq 'compile when-list)
|
1245
|
+
(memq 'expand when-list)
|
1246
|
+
(and (eq? m 'c&e) (memq 'eval when-list)))
|
1247
|
+
(top-level-eval-hook
|
1248
|
+
(expand-top-sequence body r w s 'e '(eval) mod)
|
1249
|
+
mod)
|
1250
|
+
'())
|
1251
|
+
(else
|
1252
|
+
'()))))))
|
1253
|
+
(else
|
1254
|
+
(list
|
1255
|
+
(if (eq? m 'c&e)
|
1256
|
+
(let ((x (expand-expr type value form e r w s mod)))
|
1257
|
+
(top-level-eval-hook x mod)
|
1258
|
+
(lambda () x))
|
1259
|
+
(lambda ()
|
1260
|
+
(expand-expr type value form e r w s mod)))))))))
|
1261
|
+
(let ((exps (map (lambda (x) (x))
|
1262
|
+
(reverse (parse body r w s m esew mod)))))
|
1263
|
+
(if (null? exps)
|
1264
|
+
(build-void s)
|
1265
|
+
(build-sequence s exps))))))
|
1266
|
+
|
1267
|
+
(define expand-install-global
|
1268
|
+
(lambda (name type e)
|
1269
|
+
(build-global-definition
|
1270
|
+
no-source
|
1271
|
+
name
|
1272
|
+
(build-primcall
|
1273
|
+
no-source
|
1274
|
+
'make-syntax-transformer
|
1275
|
+
(list (build-data no-source name)
|
1276
|
+
(build-data no-source
|
1277
|
+
(if (eq? type 'define-syntax-parameter-form)
|
1278
|
+
'syntax-parameter
|
1279
|
+
'macro))
|
1280
|
+
e)))))
|
1281
|
+
|
1282
|
+
(define parse-when-list
|
1283
|
+
(lambda (e when-list)
|
1284
|
+
;; `when-list' is syntax'd version of list of situations. We
|
1285
|
+
;; could match these keywords lexically, via free-id=?, but then
|
1286
|
+
;; we twingle the definition of eval-when to the bindings of
|
1287
|
+
;; eval, load, expand, and compile, which is totally unintended.
|
1288
|
+
;; So do a symbolic match instead.
|
1289
|
+
(let ((result (strip when-list empty-wrap)))
|
1290
|
+
(let lp ((l result))
|
1291
|
+
(if (null? l)
|
1292
|
+
result
|
1293
|
+
(if (memq (car l) '(compile load eval expand))
|
1294
|
+
(lp (cdr l))
|
1295
|
+
(syntax-violation 'eval-when "invalid situation" e
|
1296
|
+
(car l))))))))
|
1297
|
+
|
1298
|
+
;; syntax-type returns seven values: type, value, form, e, w, s, and
|
1299
|
+
;; mod. The first two are described in the table below.
|
1300
|
+
;;
|
1301
|
+
;; type value explanation
|
1302
|
+
;; -------------------------------------------------------------------
|
1303
|
+
;; core procedure core singleton
|
1304
|
+
;; core-form procedure core form
|
1305
|
+
;; module-ref procedure @ or @@ singleton
|
1306
|
+
;; lexical name lexical variable reference
|
1307
|
+
;; global name global variable reference
|
1308
|
+
;; begin none begin keyword
|
1309
|
+
;; define none define keyword
|
1310
|
+
;; define-syntax none define-syntax keyword
|
1311
|
+
;; define-syntax-parameter none define-syntax-parameter keyword
|
1312
|
+
;; local-syntax rec? letrec-syntax/let-syntax keyword
|
1313
|
+
;; eval-when none eval-when keyword
|
1314
|
+
;; syntax level pattern variable
|
1315
|
+
;; displaced-lexical none displaced lexical identifier
|
1316
|
+
;; lexical-call name call to lexical variable
|
1317
|
+
;; global-call name call to global variable
|
1318
|
+
;; primitive-call name call to primitive
|
1319
|
+
;; call none any other call
|
1320
|
+
;; begin-form none begin expression
|
1321
|
+
;; define-form id variable definition
|
1322
|
+
;; define-syntax-form id syntax definition
|
1323
|
+
;; define-syntax-parameter-form id syntax parameter definition
|
1324
|
+
;; local-syntax-form rec? syntax definition
|
1325
|
+
;; eval-when-form none eval-when form
|
1326
|
+
;; constant none self-evaluating datum
|
1327
|
+
;; other none anything else
|
1328
|
+
;;
|
1329
|
+
;; form is the entire form. For definition forms (define-form,
|
1330
|
+
;; define-syntax-form, and define-syntax-parameter-form), e is the
|
1331
|
+
;; rhs expression. For all others, e is the entire form. w is the
|
1332
|
+
;; wrap for both form and e. s is the source for the entire form.
|
1333
|
+
;; mod is the module for both form and e.
|
1334
|
+
;;
|
1335
|
+
;; syntax-type expands macros and unwraps as necessary to get to one
|
1336
|
+
;; of the forms above. It also parses definition forms, although
|
1337
|
+
;; perhaps this should be done by the consumer.
|
1338
|
+
|
1339
|
+
(define syntax-type
|
1340
|
+
(lambda (e r w s rib mod for-car?)
|
1341
|
+
(cond
|
1342
|
+
((symbol? e)
|
1343
|
+
(call-with-values (lambda () (resolve-identifier e w r mod #t))
|
1344
|
+
(lambda (type value mod*)
|
1345
|
+
(case type
|
1346
|
+
((macro)
|
1347
|
+
(if for-car?
|
1348
|
+
(values type value e e w s mod)
|
1349
|
+
(syntax-type (expand-macro value e r w s rib mod)
|
1350
|
+
r empty-wrap s rib mod #f)))
|
1351
|
+
((global)
|
1352
|
+
;; Toplevel definitions may resolve to bindings with
|
1353
|
+
;; different names or in different modules.
|
1354
|
+
(values type value e value w s mod*))
|
1355
|
+
(else (values type value e e w s mod))))))
|
1356
|
+
((pair? e)
|
1357
|
+
(let ((first (car e)))
|
1358
|
+
(call-with-values
|
1359
|
+
(lambda () (syntax-type first r w s rib mod #t))
|
1360
|
+
(lambda (ftype fval fform fe fw fs fmod)
|
1361
|
+
(case ftype
|
1362
|
+
((lexical)
|
1363
|
+
(values 'lexical-call fval e e w s mod))
|
1364
|
+
((global)
|
1365
|
+
(if (equal? fmod '(primitive))
|
1366
|
+
(values 'primitive-call fval e e w s mod)
|
1367
|
+
;; If we got here via an (@@ ...) expansion, we
|
1368
|
+
;; need to make sure the fmod information is
|
1369
|
+
;; propagated back correctly -- hence this
|
1370
|
+
;; consing.
|
1371
|
+
(values 'global-call (make-syntax-object fval w fmod)
|
1372
|
+
e e w s mod)))
|
1373
|
+
((macro)
|
1374
|
+
(syntax-type (expand-macro fval e r w s rib mod)
|
1375
|
+
r empty-wrap s rib mod for-car?))
|
1376
|
+
((module-ref)
|
1377
|
+
(call-with-values (lambda () (fval e r w mod))
|
1378
|
+
(lambda (e r w s mod)
|
1379
|
+
(syntax-type e r w s rib mod for-car?))))
|
1380
|
+
((core)
|
1381
|
+
(values 'core-form fval e e w s mod))
|
1382
|
+
((local-syntax)
|
1383
|
+
(values 'local-syntax-form fval e e w s mod))
|
1384
|
+
((begin)
|
1385
|
+
(values 'begin-form #f e e w s mod))
|
1386
|
+
((eval-when)
|
1387
|
+
(values 'eval-when-form #f e e w s mod))
|
1388
|
+
((define)
|
1389
|
+
(syntax-case e ()
|
1390
|
+
((_ name val)
|
1391
|
+
(id? #'name)
|
1392
|
+
(values 'define-form #'name e #'val w s mod))
|
1393
|
+
((_ (name . args) e1 e2 ...)
|
1394
|
+
(and (id? #'name)
|
1395
|
+
(valid-bound-ids? (lambda-var-list #'args)))
|
1396
|
+
;; need lambda here...
|
1397
|
+
(values 'define-form (wrap #'name w mod)
|
1398
|
+
(wrap e w mod)
|
1399
|
+
(decorate-source
|
1400
|
+
(cons #'lambda (wrap #'(args e1 e2 ...) w mod))
|
1401
|
+
s)
|
1402
|
+
empty-wrap s mod))
|
1403
|
+
((_ name)
|
1404
|
+
(id? #'name)
|
1405
|
+
(values 'define-form (wrap #'name w mod)
|
1406
|
+
(wrap e w mod)
|
1407
|
+
#'(if #f #f)
|
1408
|
+
empty-wrap s mod))))
|
1409
|
+
((define-syntax)
|
1410
|
+
(syntax-case e ()
|
1411
|
+
((_ name val)
|
1412
|
+
(id? #'name)
|
1413
|
+
(values 'define-syntax-form #'name e #'val w s mod))))
|
1414
|
+
((define-syntax-parameter)
|
1415
|
+
(syntax-case e ()
|
1416
|
+
((_ name val)
|
1417
|
+
(id? #'name)
|
1418
|
+
(values 'define-syntax-parameter-form #'name e #'val w s mod))))
|
1419
|
+
(else
|
1420
|
+
(values 'call #f e e w s mod)))))))
|
1421
|
+
((syntax-object? e)
|
1422
|
+
(syntax-type (syntax-object-expression e)
|
1423
|
+
r
|
1424
|
+
(join-wraps w (syntax-object-wrap e))
|
1425
|
+
(or (source-annotation e) s) rib
|
1426
|
+
(or (syntax-object-module e) mod) for-car?))
|
1427
|
+
((self-evaluating? e) (values 'constant #f e e w s mod))
|
1428
|
+
(else (values 'other #f e e w s mod)))))
|
1429
|
+
|
1430
|
+
(define expand
|
1431
|
+
(lambda (e r w mod)
|
1432
|
+
(call-with-values
|
1433
|
+
(lambda () (syntax-type e r w (source-annotation e) #f mod #f))
|
1434
|
+
(lambda (type value form e w s mod)
|
1435
|
+
(expand-expr type value form e r w s mod)))))
|
1436
|
+
|
1437
|
+
(define expand-expr
|
1438
|
+
(lambda (type value form e r w s mod)
|
1439
|
+
(case type
|
1440
|
+
((lexical)
|
1441
|
+
(build-lexical-reference 'value s e value))
|
1442
|
+
((core core-form)
|
1443
|
+
;; apply transformer
|
1444
|
+
(value e r w s mod))
|
1445
|
+
((module-ref)
|
1446
|
+
(call-with-values (lambda () (value e r w mod))
|
1447
|
+
(lambda (e r w s mod)
|
1448
|
+
(expand e r w mod))))
|
1449
|
+
((lexical-call)
|
1450
|
+
(expand-call
|
1451
|
+
(let ((id (car e)))
|
1452
|
+
(build-lexical-reference 'fun (source-annotation id)
|
1453
|
+
(if (syntax-object? id)
|
1454
|
+
(syntax->datum id)
|
1455
|
+
id)
|
1456
|
+
value))
|
1457
|
+
e r w s mod))
|
1458
|
+
((global-call)
|
1459
|
+
(expand-call
|
1460
|
+
(build-global-reference (source-annotation (car e))
|
1461
|
+
(if (syntax-object? value)
|
1462
|
+
(syntax-object-expression value)
|
1463
|
+
value)
|
1464
|
+
(if (syntax-object? value)
|
1465
|
+
(syntax-object-module value)
|
1466
|
+
mod))
|
1467
|
+
e r w s mod))
|
1468
|
+
((primitive-call)
|
1469
|
+
(syntax-case e ()
|
1470
|
+
((_ e ...)
|
1471
|
+
(build-primcall s
|
1472
|
+
value
|
1473
|
+
(map (lambda (e) (expand e r w mod))
|
1474
|
+
#'(e ...))))))
|
1475
|
+
((constant) (build-data s (strip (source-wrap e w s mod) empty-wrap)))
|
1476
|
+
((global) (build-global-reference s value mod))
|
1477
|
+
((call) (expand-call (expand (car e) r w mod) e r w s mod))
|
1478
|
+
((begin-form)
|
1479
|
+
(syntax-case e ()
|
1480
|
+
((_ e1 e2 ...) (expand-sequence #'(e1 e2 ...) r w s mod))
|
1481
|
+
((_)
|
1482
|
+
(syntax-violation #f "sequence of zero expressions"
|
1483
|
+
(source-wrap e w s mod)))))
|
1484
|
+
((local-syntax-form)
|
1485
|
+
(expand-local-syntax value e r w s mod expand-sequence))
|
1486
|
+
((eval-when-form)
|
1487
|
+
(syntax-case e ()
|
1488
|
+
((_ (x ...) e1 e2 ...)
|
1489
|
+
(let ((when-list (parse-when-list e #'(x ...))))
|
1490
|
+
(if (memq 'eval when-list)
|
1491
|
+
(expand-sequence #'(e1 e2 ...) r w s mod)
|
1492
|
+
(expand-void))))))
|
1493
|
+
((define-form define-syntax-form define-syntax-parameter-form)
|
1494
|
+
(syntax-violation #f "definition in expression context, where definitions are not allowed,"
|
1495
|
+
(source-wrap form w s mod)))
|
1496
|
+
((syntax)
|
1497
|
+
(syntax-violation #f "reference to pattern variable outside syntax form"
|
1498
|
+
(source-wrap e w s mod)))
|
1499
|
+
((displaced-lexical)
|
1500
|
+
(syntax-violation #f "reference to identifier outside its scope"
|
1501
|
+
(source-wrap e w s mod)))
|
1502
|
+
(else (syntax-violation #f "unexpected syntax"
|
1503
|
+
(source-wrap e w s mod))))))
|
1504
|
+
|
1505
|
+
(define expand-call
|
1506
|
+
(lambda (x e r w s mod)
|
1507
|
+
(syntax-case e ()
|
1508
|
+
((e0 e1 ...)
|
1509
|
+
(build-call s x
|
1510
|
+
(map (lambda (e) (expand e r w mod)) #'(e1 ...)))))))
|
1511
|
+
|
1512
|
+
;; (What follows is my interpretation of what's going on here -- Andy)
|
1513
|
+
;;
|
1514
|
+
;; A macro takes an expression, a tree, the leaves of which are identifiers
|
1515
|
+
;; and datums. Identifiers are symbols along with a wrap and a module. For
|
1516
|
+
;; efficiency, subtrees that share wraps and modules may be grouped as one
|
1517
|
+
;; syntax object.
|
1518
|
+
;;
|
1519
|
+
;; Going into the expansion, the expression is given an anti-mark, which
|
1520
|
+
;; logically propagates to all leaves. Then, in the new expression returned
|
1521
|
+
;; from the transfomer, if we see an expression with an anti-mark, we know it
|
1522
|
+
;; pertains to the original expression; conversely, expressions without the
|
1523
|
+
;; anti-mark are known to be introduced by the transformer.
|
1524
|
+
;;
|
1525
|
+
;; OK, good until now. We know this algorithm does lexical scoping
|
1526
|
+
;; appropriately because it's widely known in the literature, and psyntax is
|
1527
|
+
;; widely used. But what about modules? Here we're on our own. What we do is
|
1528
|
+
;; to mark the module of expressions produced by a macro as pertaining to the
|
1529
|
+
;; module that was current when the macro was defined -- that is, free
|
1530
|
+
;; identifiers introduced by a macro are scoped in the macro's module, not in
|
1531
|
+
;; the expansion's module. Seems to work well.
|
1532
|
+
;;
|
1533
|
+
;; The only wrinkle is when we want a macro to expand to code in another
|
1534
|
+
;; module, as is the case for the r6rs `library' form -- the body expressions
|
1535
|
+
;; should be scoped relative the the new module, the one defined by the macro.
|
1536
|
+
;; For that, use `(@@ mod-name body)'.
|
1537
|
+
;;
|
1538
|
+
;; Part of the macro output will be from the site of the macro use and part
|
1539
|
+
;; from the macro definition. We allow source information from the macro use
|
1540
|
+
;; to pass through, but we annotate the parts coming from the macro with the
|
1541
|
+
;; source location information corresponding to the macro use. It would be
|
1542
|
+
;; really nice if we could also annotate introduced expressions with the
|
1543
|
+
;; locations corresponding to the macro definition, but that is not yet
|
1544
|
+
;; possible.
|
1545
|
+
(define expand-macro
|
1546
|
+
(lambda (p e r w s rib mod)
|
1547
|
+
(define rebuild-macro-output
|
1548
|
+
(lambda (x m)
|
1549
|
+
(cond ((pair? x)
|
1550
|
+
(decorate-source
|
1551
|
+
(cons (rebuild-macro-output (car x) m)
|
1552
|
+
(rebuild-macro-output (cdr x) m))
|
1553
|
+
s))
|
1554
|
+
((syntax-object? x)
|
1555
|
+
(let ((w (syntax-object-wrap x)))
|
1556
|
+
(let ((ms (wrap-marks w)) (ss (wrap-subst w)))
|
1557
|
+
(if (and (pair? ms) (eq? (car ms) the-anti-mark))
|
1558
|
+
;; output is from original text
|
1559
|
+
(make-syntax-object
|
1560
|
+
(syntax-object-expression x)
|
1561
|
+
(make-wrap (cdr ms) (if rib (cons rib (cdr ss)) (cdr ss)))
|
1562
|
+
(syntax-object-module x))
|
1563
|
+
;; output introduced by macro
|
1564
|
+
(make-syntax-object
|
1565
|
+
(decorate-source (syntax-object-expression x) s)
|
1566
|
+
(make-wrap (cons m ms)
|
1567
|
+
(if rib
|
1568
|
+
(cons rib (cons 'shift ss))
|
1569
|
+
(cons 'shift ss)))
|
1570
|
+
(syntax-object-module x))))))
|
1571
|
+
|
1572
|
+
((vector? x)
|
1573
|
+
(let* ((n (vector-length x))
|
1574
|
+
(v (decorate-source (make-vector n) s)))
|
1575
|
+
(do ((i 0 (fx+ i 1)))
|
1576
|
+
((fx= i n) v)
|
1577
|
+
(vector-set! v i
|
1578
|
+
(rebuild-macro-output (vector-ref x i) m)))))
|
1579
|
+
((symbol? x)
|
1580
|
+
(syntax-violation #f "encountered raw symbol in macro output"
|
1581
|
+
(source-wrap e w (wrap-subst w) mod) x))
|
1582
|
+
(else (decorate-source x s)))))
|
1583
|
+
(with-fluids ((transformer-environment
|
1584
|
+
(lambda (k) (k e r w s rib mod))))
|
1585
|
+
(rebuild-macro-output (p (source-wrap e (anti-mark w) s mod))
|
1586
|
+
(new-mark)))))
|
1587
|
+
|
1588
|
+
(define expand-body
|
1589
|
+
;; In processing the forms of the body, we create a new, empty wrap.
|
1590
|
+
;; This wrap is augmented (destructively) each time we discover that
|
1591
|
+
;; the next form is a definition. This is done:
|
1592
|
+
;;
|
1593
|
+
;; (1) to allow the first nondefinition form to be a call to
|
1594
|
+
;; one of the defined ids even if the id previously denoted a
|
1595
|
+
;; definition keyword or keyword for a macro expanding into a
|
1596
|
+
;; definition;
|
1597
|
+
;; (2) to prevent subsequent definition forms (but unfortunately
|
1598
|
+
;; not earlier ones) and the first nondefinition form from
|
1599
|
+
;; confusing one of the bound identifiers for an auxiliary
|
1600
|
+
;; keyword; and
|
1601
|
+
;; (3) so that we do not need to restart the expansion of the
|
1602
|
+
;; first nondefinition form, which is problematic anyway
|
1603
|
+
;; since it might be the first element of a begin that we
|
1604
|
+
;; have just spliced into the body (meaning if we restarted,
|
1605
|
+
;; we'd really need to restart with the begin or the macro
|
1606
|
+
;; call that expanded into the begin, and we'd have to give
|
1607
|
+
;; up allowing (begin <defn>+ <expr>+), which is itself
|
1608
|
+
;; problematic since we don't know if a begin contains only
|
1609
|
+
;; definitions until we've expanded it).
|
1610
|
+
;;
|
1611
|
+
;; Before processing the body, we also create a new environment
|
1612
|
+
;; containing a placeholder for the bindings we will add later and
|
1613
|
+
;; associate this environment with each form. In processing a
|
1614
|
+
;; let-syntax or letrec-syntax, the associated environment may be
|
1615
|
+
;; augmented with local keyword bindings, so the environment may
|
1616
|
+
;; be different for different forms in the body. Once we have
|
1617
|
+
;; gathered up all of the definitions, we evaluate the transformer
|
1618
|
+
;; expressions and splice into r at the placeholder the new variable
|
1619
|
+
;; and keyword bindings. This allows let-syntax or letrec-syntax
|
1620
|
+
;; forms local to a portion or all of the body to shadow the
|
1621
|
+
;; definition bindings.
|
1622
|
+
;;
|
1623
|
+
;; Subforms of a begin, let-syntax, or letrec-syntax are spliced
|
1624
|
+
;; into the body.
|
1625
|
+
;;
|
1626
|
+
;; outer-form is fully wrapped w/source
|
1627
|
+
(lambda (body outer-form r w mod)
|
1628
|
+
(let* ((r (cons '("placeholder" . (placeholder)) r))
|
1629
|
+
(ribcage (make-empty-ribcage))
|
1630
|
+
(w (make-wrap (wrap-marks w) (cons ribcage (wrap-subst w)))))
|
1631
|
+
(let parse ((body (map (lambda (x) (cons r (wrap x w mod))) body))
|
1632
|
+
(ids '()) (labels '())
|
1633
|
+
(var-ids '()) (vars '()) (vals '()) (bindings '()))
|
1634
|
+
(if (null? body)
|
1635
|
+
(syntax-violation #f "no expressions in body" outer-form)
|
1636
|
+
(let ((e (cdar body)) (er (caar body)))
|
1637
|
+
(call-with-values
|
1638
|
+
(lambda () (syntax-type e er empty-wrap (source-annotation e) ribcage mod #f))
|
1639
|
+
(lambda (type value form e w s mod)
|
1640
|
+
(case type
|
1641
|
+
((define-form)
|
1642
|
+
(let ((id (wrap value w mod)) (label (gen-label)))
|
1643
|
+
(let ((var (gen-var id)))
|
1644
|
+
(extend-ribcage! ribcage id label)
|
1645
|
+
(parse (cdr body)
|
1646
|
+
(cons id ids) (cons label labels)
|
1647
|
+
(cons id var-ids)
|
1648
|
+
(cons var vars) (cons (cons er (wrap e w mod)) vals)
|
1649
|
+
(cons (make-binding 'lexical var) bindings)))))
|
1650
|
+
((define-syntax-form)
|
1651
|
+
(let ((id (wrap value w mod))
|
1652
|
+
(label (gen-label))
|
1653
|
+
(trans-r (macros-only-env er)))
|
1654
|
+
(extend-ribcage! ribcage id label)
|
1655
|
+
;; As required by R6RS, evaluate the right-hand-sides of internal
|
1656
|
+
;; syntax definition forms and add their transformers to the
|
1657
|
+
;; compile-time environment immediately, so that the newly-defined
|
1658
|
+
;; keywords may be used in definition context within the same
|
1659
|
+
;; lexical contour.
|
1660
|
+
(set-cdr! r (extend-env
|
1661
|
+
(list label)
|
1662
|
+
(list (make-binding
|
1663
|
+
'macro
|
1664
|
+
(eval-local-transformer
|
1665
|
+
(expand e trans-r w mod)
|
1666
|
+
mod)))
|
1667
|
+
(cdr r)))
|
1668
|
+
(parse (cdr body) (cons id ids) labels var-ids vars vals bindings)))
|
1669
|
+
((define-syntax-parameter-form)
|
1670
|
+
;; Same as define-syntax-form, different binding type though.
|
1671
|
+
(let ((id (wrap value w mod))
|
1672
|
+
(label (gen-label))
|
1673
|
+
(trans-r (macros-only-env er)))
|
1674
|
+
(extend-ribcage! ribcage id label)
|
1675
|
+
(set-cdr! r (extend-env
|
1676
|
+
(list label)
|
1677
|
+
(list (make-binding
|
1678
|
+
'syntax-parameter
|
1679
|
+
(eval-local-transformer
|
1680
|
+
(expand e trans-r w mod)
|
1681
|
+
mod)))
|
1682
|
+
(cdr r)))
|
1683
|
+
(parse (cdr body) (cons id ids) labels var-ids vars vals bindings)))
|
1684
|
+
((begin-form)
|
1685
|
+
(syntax-case e ()
|
1686
|
+
((_ e1 ...)
|
1687
|
+
(parse (let f ((forms #'(e1 ...)))
|
1688
|
+
(if (null? forms)
|
1689
|
+
(cdr body)
|
1690
|
+
(cons (cons er (wrap (car forms) w mod))
|
1691
|
+
(f (cdr forms)))))
|
1692
|
+
ids labels var-ids vars vals bindings))))
|
1693
|
+
((local-syntax-form)
|
1694
|
+
(expand-local-syntax value e er w s mod
|
1695
|
+
(lambda (forms er w s mod)
|
1696
|
+
(parse (let f ((forms forms))
|
1697
|
+
(if (null? forms)
|
1698
|
+
(cdr body)
|
1699
|
+
(cons (cons er (wrap (car forms) w mod))
|
1700
|
+
(f (cdr forms)))))
|
1701
|
+
ids labels var-ids vars vals bindings))))
|
1702
|
+
(else ; found a non-definition
|
1703
|
+
(if (null? ids)
|
1704
|
+
(build-sequence no-source
|
1705
|
+
(map (lambda (x)
|
1706
|
+
(expand (cdr x) (car x) empty-wrap mod))
|
1707
|
+
(cons (cons er (source-wrap e w s mod))
|
1708
|
+
(cdr body))))
|
1709
|
+
(begin
|
1710
|
+
(if (not (valid-bound-ids? ids))
|
1711
|
+
(syntax-violation
|
1712
|
+
#f "invalid or duplicate identifier in definition"
|
1713
|
+
outer-form))
|
1714
|
+
(set-cdr! r (extend-env labels bindings (cdr r)))
|
1715
|
+
(build-letrec no-source #t
|
1716
|
+
(reverse (map syntax->datum var-ids))
|
1717
|
+
(reverse vars)
|
1718
|
+
(map (lambda (x)
|
1719
|
+
(expand (cdr x) (car x) empty-wrap mod))
|
1720
|
+
(reverse vals))
|
1721
|
+
(build-sequence no-source
|
1722
|
+
(map (lambda (x)
|
1723
|
+
(expand (cdr x) (car x) empty-wrap mod))
|
1724
|
+
(cons (cons er (source-wrap e w s mod))
|
1725
|
+
(cdr body)))))))))))))))))
|
1726
|
+
|
1727
|
+
(define expand-local-syntax
|
1728
|
+
(lambda (rec? e r w s mod k)
|
1729
|
+
(syntax-case e ()
|
1730
|
+
((_ ((id val) ...) e1 e2 ...)
|
1731
|
+
(let ((ids #'(id ...)))
|
1732
|
+
(if (not (valid-bound-ids? ids))
|
1733
|
+
(syntax-violation #f "duplicate bound keyword" e)
|
1734
|
+
(let ((labels (gen-labels ids)))
|
1735
|
+
(let ((new-w (make-binding-wrap ids labels w)))
|
1736
|
+
(k #'(e1 e2 ...)
|
1737
|
+
(extend-env
|
1738
|
+
labels
|
1739
|
+
(let ((w (if rec? new-w w))
|
1740
|
+
(trans-r (macros-only-env r)))
|
1741
|
+
(map (lambda (x)
|
1742
|
+
(make-binding 'macro
|
1743
|
+
(eval-local-transformer
|
1744
|
+
(expand x trans-r w mod)
|
1745
|
+
mod)))
|
1746
|
+
#'(val ...)))
|
1747
|
+
r)
|
1748
|
+
new-w
|
1749
|
+
s
|
1750
|
+
mod))))))
|
1751
|
+
(_ (syntax-violation #f "bad local syntax definition"
|
1752
|
+
(source-wrap e w s mod))))))
|
1753
|
+
|
1754
|
+
(define eval-local-transformer
|
1755
|
+
(lambda (expanded mod)
|
1756
|
+
(let ((p (local-eval-hook expanded mod)))
|
1757
|
+
(if (procedure? p)
|
1758
|
+
p
|
1759
|
+
(syntax-violation #f "nonprocedure transformer" p)))))
|
1760
|
+
|
1761
|
+
(define expand-void
|
1762
|
+
(lambda ()
|
1763
|
+
(build-void no-source)))
|
1764
|
+
|
1765
|
+
(define ellipsis?
|
1766
|
+
(lambda (e r mod)
|
1767
|
+
(and (nonsymbol-id? e)
|
1768
|
+
;; If there is a binding for the special identifier
|
1769
|
+
;; #{ $sc-ellipsis }# in the lexical environment of E,
|
1770
|
+
;; and if the associated binding type is 'ellipsis',
|
1771
|
+
;; then the binding's value specifies the custom ellipsis
|
1772
|
+
;; identifier within that lexical environment, and the
|
1773
|
+
;; comparison is done using 'bound-id=?'.
|
1774
|
+
(call-with-values
|
1775
|
+
(lambda () (resolve-identifier
|
1776
|
+
(make-syntax-object '#{ $sc-ellipsis }#
|
1777
|
+
(syntax-object-wrap e)
|
1778
|
+
(syntax-object-module e))
|
1779
|
+
empty-wrap r mod #f))
|
1780
|
+
(lambda (type value mod)
|
1781
|
+
(if (eq? type 'ellipsis)
|
1782
|
+
(bound-id=? e value)
|
1783
|
+
(free-id=? e #'(... ...))))))))
|
1784
|
+
|
1785
|
+
(define lambda-formals
|
1786
|
+
(lambda (orig-args)
|
1787
|
+
(define (req args rreq)
|
1788
|
+
(syntax-case args ()
|
1789
|
+
(()
|
1790
|
+
(check (reverse rreq) #f))
|
1791
|
+
((a . b) (id? #'a)
|
1792
|
+
(req #'b (cons #'a rreq)))
|
1793
|
+
(r (id? #'r)
|
1794
|
+
(check (reverse rreq) #'r))
|
1795
|
+
(else
|
1796
|
+
(syntax-violation 'lambda "invalid argument list" orig-args args))))
|
1797
|
+
(define (check req rest)
|
1798
|
+
(cond
|
1799
|
+
((distinct-bound-ids? (if rest (cons rest req) req))
|
1800
|
+
(values req #f rest #f))
|
1801
|
+
(else
|
1802
|
+
(syntax-violation 'lambda "duplicate identifier in argument list"
|
1803
|
+
orig-args))))
|
1804
|
+
(req orig-args '())))
|
1805
|
+
|
1806
|
+
(define expand-simple-lambda
|
1807
|
+
(lambda (e r w s mod req rest meta body)
|
1808
|
+
(let* ((ids (if rest (append req (list rest)) req))
|
1809
|
+
(vars (map gen-var ids))
|
1810
|
+
(labels (gen-labels ids)))
|
1811
|
+
(build-simple-lambda
|
1812
|
+
s
|
1813
|
+
(map syntax->datum req) (and rest (syntax->datum rest)) vars
|
1814
|
+
meta
|
1815
|
+
(expand-body body (source-wrap e w s mod)
|
1816
|
+
(extend-var-env labels vars r)
|
1817
|
+
(make-binding-wrap ids labels w)
|
1818
|
+
mod)))))
|
1819
|
+
|
1820
|
+
(define lambda*-formals
|
1821
|
+
(lambda (orig-args)
|
1822
|
+
(define (req args rreq)
|
1823
|
+
(syntax-case args ()
|
1824
|
+
(()
|
1825
|
+
(check (reverse rreq) '() #f '()))
|
1826
|
+
((a . b) (id? #'a)
|
1827
|
+
(req #'b (cons #'a rreq)))
|
1828
|
+
((a . b) (eq? (syntax->datum #'a) #:optional)
|
1829
|
+
(opt #'b (reverse rreq) '()))
|
1830
|
+
((a . b) (eq? (syntax->datum #'a) #:key)
|
1831
|
+
(key #'b (reverse rreq) '() '()))
|
1832
|
+
((a b) (eq? (syntax->datum #'a) #:rest)
|
1833
|
+
(rest #'b (reverse rreq) '() '()))
|
1834
|
+
(r (id? #'r)
|
1835
|
+
(rest #'r (reverse rreq) '() '()))
|
1836
|
+
(else
|
1837
|
+
(syntax-violation 'lambda* "invalid argument list" orig-args args))))
|
1838
|
+
(define (opt args req ropt)
|
1839
|
+
(syntax-case args ()
|
1840
|
+
(()
|
1841
|
+
(check req (reverse ropt) #f '()))
|
1842
|
+
((a . b) (id? #'a)
|
1843
|
+
(opt #'b req (cons #'(a #f) ropt)))
|
1844
|
+
(((a init) . b) (id? #'a)
|
1845
|
+
(opt #'b req (cons #'(a init) ropt)))
|
1846
|
+
((a . b) (eq? (syntax->datum #'a) #:key)
|
1847
|
+
(key #'b req (reverse ropt) '()))
|
1848
|
+
((a b) (eq? (syntax->datum #'a) #:rest)
|
1849
|
+
(rest #'b req (reverse ropt) '()))
|
1850
|
+
(r (id? #'r)
|
1851
|
+
(rest #'r req (reverse ropt) '()))
|
1852
|
+
(else
|
1853
|
+
(syntax-violation 'lambda* "invalid optional argument list"
|
1854
|
+
orig-args args))))
|
1855
|
+
(define (key args req opt rkey)
|
1856
|
+
(syntax-case args ()
|
1857
|
+
(()
|
1858
|
+
(check req opt #f (cons #f (reverse rkey))))
|
1859
|
+
((a . b) (id? #'a)
|
1860
|
+
(with-syntax ((k (symbol->keyword (syntax->datum #'a))))
|
1861
|
+
(key #'b req opt (cons #'(k a #f) rkey))))
|
1862
|
+
(((a init) . b) (id? #'a)
|
1863
|
+
(with-syntax ((k (symbol->keyword (syntax->datum #'a))))
|
1864
|
+
(key #'b req opt (cons #'(k a init) rkey))))
|
1865
|
+
(((a init k) . b) (and (id? #'a)
|
1866
|
+
(keyword? (syntax->datum #'k)))
|
1867
|
+
(key #'b req opt (cons #'(k a init) rkey)))
|
1868
|
+
((aok) (eq? (syntax->datum #'aok) #:allow-other-keys)
|
1869
|
+
(check req opt #f (cons #t (reverse rkey))))
|
1870
|
+
((aok a b) (and (eq? (syntax->datum #'aok) #:allow-other-keys)
|
1871
|
+
(eq? (syntax->datum #'a) #:rest))
|
1872
|
+
(rest #'b req opt (cons #t (reverse rkey))))
|
1873
|
+
((aok . r) (and (eq? (syntax->datum #'aok) #:allow-other-keys)
|
1874
|
+
(id? #'r))
|
1875
|
+
(rest #'r req opt (cons #t (reverse rkey))))
|
1876
|
+
((a b) (eq? (syntax->datum #'a) #:rest)
|
1877
|
+
(rest #'b req opt (cons #f (reverse rkey))))
|
1878
|
+
(r (id? #'r)
|
1879
|
+
(rest #'r req opt (cons #f (reverse rkey))))
|
1880
|
+
(else
|
1881
|
+
(syntax-violation 'lambda* "invalid keyword argument list"
|
1882
|
+
orig-args args))))
|
1883
|
+
(define (rest args req opt kw)
|
1884
|
+
(syntax-case args ()
|
1885
|
+
(r (id? #'r)
|
1886
|
+
(check req opt #'r kw))
|
1887
|
+
(else
|
1888
|
+
(syntax-violation 'lambda* "invalid rest argument"
|
1889
|
+
orig-args args))))
|
1890
|
+
(define (check req opt rest kw)
|
1891
|
+
(cond
|
1892
|
+
((distinct-bound-ids?
|
1893
|
+
(append req (map car opt) (if rest (list rest) '())
|
1894
|
+
(if (pair? kw) (map cadr (cdr kw)) '())))
|
1895
|
+
(values req opt rest kw))
|
1896
|
+
(else
|
1897
|
+
(syntax-violation 'lambda* "duplicate identifier in argument list"
|
1898
|
+
orig-args))))
|
1899
|
+
(req orig-args '())))
|
1900
|
+
|
1901
|
+
(define expand-lambda-case
|
1902
|
+
(lambda (e r w s mod get-formals clauses)
|
1903
|
+
(define (parse-req req opt rest kw body)
|
1904
|
+
(let ((vars (map gen-var req))
|
1905
|
+
(labels (gen-labels req)))
|
1906
|
+
(let ((r* (extend-var-env labels vars r))
|
1907
|
+
(w* (make-binding-wrap req labels w)))
|
1908
|
+
(parse-opt (map syntax->datum req)
|
1909
|
+
opt rest kw body (reverse vars) r* w* '() '()))))
|
1910
|
+
(define (parse-opt req opt rest kw body vars r* w* out inits)
|
1911
|
+
(cond
|
1912
|
+
((pair? opt)
|
1913
|
+
(syntax-case (car opt) ()
|
1914
|
+
((id i)
|
1915
|
+
(let* ((v (gen-var #'id))
|
1916
|
+
(l (gen-labels (list v)))
|
1917
|
+
(r** (extend-var-env l (list v) r*))
|
1918
|
+
(w** (make-binding-wrap (list #'id) l w*)))
|
1919
|
+
(parse-opt req (cdr opt) rest kw body (cons v vars)
|
1920
|
+
r** w** (cons (syntax->datum #'id) out)
|
1921
|
+
(cons (expand #'i r* w* mod) inits))))))
|
1922
|
+
(rest
|
1923
|
+
(let* ((v (gen-var rest))
|
1924
|
+
(l (gen-labels (list v)))
|
1925
|
+
(r* (extend-var-env l (list v) r*))
|
1926
|
+
(w* (make-binding-wrap (list rest) l w*)))
|
1927
|
+
(parse-kw req (if (pair? out) (reverse out) #f)
|
1928
|
+
(syntax->datum rest)
|
1929
|
+
(if (pair? kw) (cdr kw) kw)
|
1930
|
+
body (cons v vars) r* w*
|
1931
|
+
(if (pair? kw) (car kw) #f)
|
1932
|
+
'() inits)))
|
1933
|
+
(else
|
1934
|
+
(parse-kw req (if (pair? out) (reverse out) #f) #f
|
1935
|
+
(if (pair? kw) (cdr kw) kw)
|
1936
|
+
body vars r* w*
|
1937
|
+
(if (pair? kw) (car kw) #f)
|
1938
|
+
'() inits))))
|
1939
|
+
(define (parse-kw req opt rest kw body vars r* w* aok out inits)
|
1940
|
+
(cond
|
1941
|
+
((pair? kw)
|
1942
|
+
(syntax-case (car kw) ()
|
1943
|
+
((k id i)
|
1944
|
+
(let* ((v (gen-var #'id))
|
1945
|
+
(l (gen-labels (list v)))
|
1946
|
+
(r** (extend-var-env l (list v) r*))
|
1947
|
+
(w** (make-binding-wrap (list #'id) l w*)))
|
1948
|
+
(parse-kw req opt rest (cdr kw) body (cons v vars)
|
1949
|
+
r** w** aok
|
1950
|
+
(cons (list (syntax->datum #'k)
|
1951
|
+
(syntax->datum #'id)
|
1952
|
+
v)
|
1953
|
+
out)
|
1954
|
+
(cons (expand #'i r* w* mod) inits))))))
|
1955
|
+
(else
|
1956
|
+
(parse-body req opt rest
|
1957
|
+
(if (or aok (pair? out)) (cons aok (reverse out)) #f)
|
1958
|
+
body (reverse vars) r* w* (reverse inits) '()))))
|
1959
|
+
(define (parse-body req opt rest kw body vars r* w* inits meta)
|
1960
|
+
(syntax-case body ()
|
1961
|
+
((docstring e1 e2 ...) (string? (syntax->datum #'docstring))
|
1962
|
+
(parse-body req opt rest kw #'(e1 e2 ...) vars r* w* inits
|
1963
|
+
(append meta
|
1964
|
+
`((documentation
|
1965
|
+
. ,(syntax->datum #'docstring))))))
|
1966
|
+
((#((k . v) ...) e1 e2 ...)
|
1967
|
+
(parse-body req opt rest kw #'(e1 e2 ...) vars r* w* inits
|
1968
|
+
(append meta (syntax->datum #'((k . v) ...)))))
|
1969
|
+
((e1 e2 ...)
|
1970
|
+
(values meta req opt rest kw inits vars
|
1971
|
+
(expand-body #'(e1 e2 ...) (source-wrap e w s mod)
|
1972
|
+
r* w* mod)))))
|
1973
|
+
|
1974
|
+
(syntax-case clauses ()
|
1975
|
+
(() (values '() #f))
|
1976
|
+
(((args e1 e2 ...) (args* e1* e2* ...) ...)
|
1977
|
+
(call-with-values (lambda () (get-formals #'args))
|
1978
|
+
(lambda (req opt rest kw)
|
1979
|
+
(call-with-values (lambda ()
|
1980
|
+
(parse-req req opt rest kw #'(e1 e2 ...)))
|
1981
|
+
(lambda (meta req opt rest kw inits vars body)
|
1982
|
+
(call-with-values
|
1983
|
+
(lambda ()
|
1984
|
+
(expand-lambda-case e r w s mod get-formals
|
1985
|
+
#'((args* e1* e2* ...) ...)))
|
1986
|
+
(lambda (meta* else*)
|
1987
|
+
(values
|
1988
|
+
(append meta meta*)
|
1989
|
+
(build-lambda-case s req opt rest kw inits vars
|
1990
|
+
body else*))))))))))))
|
1991
|
+
|
1992
|
+
;; data
|
1993
|
+
|
1994
|
+
;; strips syntax-objects down to top-wrap
|
1995
|
+
;;
|
1996
|
+
;; since only the head of a list is annotated by the reader, not each pair
|
1997
|
+
;; in the spine, we also check for pairs whose cars are annotated in case
|
1998
|
+
;; we've been passed the cdr of an annotated list
|
1999
|
+
|
2000
|
+
(define strip
|
2001
|
+
(lambda (x w)
|
2002
|
+
(if (top-marked? w)
|
2003
|
+
x
|
2004
|
+
(let f ((x x))
|
2005
|
+
(cond
|
2006
|
+
((syntax-object? x)
|
2007
|
+
(strip (syntax-object-expression x) (syntax-object-wrap x)))
|
2008
|
+
((pair? x)
|
2009
|
+
(let ((a (f (car x))) (d (f (cdr x))))
|
2010
|
+
(if (and (eq? a (car x)) (eq? d (cdr x)))
|
2011
|
+
x
|
2012
|
+
(cons a d))))
|
2013
|
+
((vector? x)
|
2014
|
+
(let ((old (vector->list x)))
|
2015
|
+
(let ((new (map f old)))
|
2016
|
+
;; inlined and-map with two args
|
2017
|
+
(let lp ((l1 old) (l2 new))
|
2018
|
+
(if (null? l1)
|
2019
|
+
x
|
2020
|
+
(if (eq? (car l1) (car l2))
|
2021
|
+
(lp (cdr l1) (cdr l2))
|
2022
|
+
(list->vector new)))))))
|
2023
|
+
(else x))))))
|
2024
|
+
|
2025
|
+
;; lexical variables
|
2026
|
+
|
2027
|
+
(define gen-var
|
2028
|
+
(lambda (id)
|
2029
|
+
(let ((id (if (syntax-object? id) (syntax-object-expression id) id)))
|
2030
|
+
(build-lexical-var no-source id))))
|
2031
|
+
|
2032
|
+
;; appears to return a reversed list
|
2033
|
+
(define lambda-var-list
|
2034
|
+
(lambda (vars)
|
2035
|
+
(let lvl ((vars vars) (ls '()) (w empty-wrap))
|
2036
|
+
(cond
|
2037
|
+
((pair? vars) (lvl (cdr vars) (cons (wrap (car vars) w #f) ls) w))
|
2038
|
+
((id? vars) (cons (wrap vars w #f) ls))
|
2039
|
+
((null? vars) ls)
|
2040
|
+
((syntax-object? vars)
|
2041
|
+
(lvl (syntax-object-expression vars)
|
2042
|
+
ls
|
2043
|
+
(join-wraps w (syntax-object-wrap vars))))
|
2044
|
+
;; include anything else to be caught by subsequent error
|
2045
|
+
;; checking
|
2046
|
+
(else (cons vars ls))))))
|
2047
|
+
|
2048
|
+
;; core transformers
|
2049
|
+
|
2050
|
+
(global-extend 'local-syntax 'letrec-syntax #t)
|
2051
|
+
(global-extend 'local-syntax 'let-syntax #f)
|
2052
|
+
|
2053
|
+
(global-extend
|
2054
|
+
'core 'syntax-parameterize
|
2055
|
+
(lambda (e r w s mod)
|
2056
|
+
(syntax-case e ()
|
2057
|
+
((_ ((var val) ...) e1 e2 ...)
|
2058
|
+
(valid-bound-ids? #'(var ...))
|
2059
|
+
(let ((names
|
2060
|
+
(map (lambda (x)
|
2061
|
+
(call-with-values
|
2062
|
+
(lambda () (resolve-identifier x w r mod #f))
|
2063
|
+
(lambda (type value mod)
|
2064
|
+
(case type
|
2065
|
+
((displaced-lexical)
|
2066
|
+
(syntax-violation 'syntax-parameterize
|
2067
|
+
"identifier out of context"
|
2068
|
+
e
|
2069
|
+
(source-wrap x w s mod)))
|
2070
|
+
((syntax-parameter)
|
2071
|
+
value)
|
2072
|
+
(else
|
2073
|
+
(syntax-violation 'syntax-parameterize
|
2074
|
+
"invalid syntax parameter"
|
2075
|
+
e
|
2076
|
+
(source-wrap x w s mod)))))))
|
2077
|
+
#'(var ...)))
|
2078
|
+
(bindings
|
2079
|
+
(let ((trans-r (macros-only-env r)))
|
2080
|
+
(map (lambda (x)
|
2081
|
+
(make-binding
|
2082
|
+
'syntax-parameter
|
2083
|
+
(eval-local-transformer (expand x trans-r w mod) mod)))
|
2084
|
+
#'(val ...)))))
|
2085
|
+
(expand-body #'(e1 e2 ...)
|
2086
|
+
(source-wrap e w s mod)
|
2087
|
+
(extend-env names bindings r)
|
2088
|
+
w
|
2089
|
+
mod)))
|
2090
|
+
(_ (syntax-violation 'syntax-parameterize "bad syntax"
|
2091
|
+
(source-wrap e w s mod))))))
|
2092
|
+
|
2093
|
+
(global-extend 'core 'quote
|
2094
|
+
(lambda (e r w s mod)
|
2095
|
+
(syntax-case e ()
|
2096
|
+
((_ e) (build-data s (strip #'e w)))
|
2097
|
+
(_ (syntax-violation 'quote "bad syntax"
|
2098
|
+
(source-wrap e w s mod))))))
|
2099
|
+
|
2100
|
+
(global-extend
|
2101
|
+
'core 'syntax
|
2102
|
+
(let ()
|
2103
|
+
(define gen-syntax
|
2104
|
+
(lambda (src e r maps ellipsis? mod)
|
2105
|
+
(if (id? e)
|
2106
|
+
(call-with-values (lambda ()
|
2107
|
+
(resolve-identifier e empty-wrap r mod #f))
|
2108
|
+
(lambda (type value mod)
|
2109
|
+
(case type
|
2110
|
+
((syntax)
|
2111
|
+
(call-with-values
|
2112
|
+
(lambda () (gen-ref src (car value) (cdr value) maps))
|
2113
|
+
(lambda (var maps)
|
2114
|
+
(values `(ref ,var) maps))))
|
2115
|
+
(else
|
2116
|
+
(if (ellipsis? e r mod)
|
2117
|
+
(syntax-violation 'syntax "misplaced ellipsis" src)
|
2118
|
+
(values `(quote ,e) maps))))))
|
2119
|
+
(syntax-case e ()
|
2120
|
+
((dots e)
|
2121
|
+
(ellipsis? #'dots r mod)
|
2122
|
+
(gen-syntax src #'e r maps (lambda (e r mod) #f) mod))
|
2123
|
+
((x dots . y)
|
2124
|
+
;; this could be about a dozen lines of code, except that we
|
2125
|
+
;; choose to handle #'(x ... ...) forms
|
2126
|
+
(ellipsis? #'dots r mod)
|
2127
|
+
(let f ((y #'y)
|
2128
|
+
(k (lambda (maps)
|
2129
|
+
(call-with-values
|
2130
|
+
(lambda ()
|
2131
|
+
(gen-syntax src #'x r
|
2132
|
+
(cons '() maps) ellipsis? mod))
|
2133
|
+
(lambda (x maps)
|
2134
|
+
(if (null? (car maps))
|
2135
|
+
(syntax-violation 'syntax "extra ellipsis"
|
2136
|
+
src)
|
2137
|
+
(values (gen-map x (car maps))
|
2138
|
+
(cdr maps))))))))
|
2139
|
+
(syntax-case y ()
|
2140
|
+
((dots . y)
|
2141
|
+
(ellipsis? #'dots r mod)
|
2142
|
+
(f #'y
|
2143
|
+
(lambda (maps)
|
2144
|
+
(call-with-values
|
2145
|
+
(lambda () (k (cons '() maps)))
|
2146
|
+
(lambda (x maps)
|
2147
|
+
(if (null? (car maps))
|
2148
|
+
(syntax-violation 'syntax "extra ellipsis" src)
|
2149
|
+
(values (gen-mappend x (car maps))
|
2150
|
+
(cdr maps))))))))
|
2151
|
+
(_ (call-with-values
|
2152
|
+
(lambda () (gen-syntax src y r maps ellipsis? mod))
|
2153
|
+
(lambda (y maps)
|
2154
|
+
(call-with-values
|
2155
|
+
(lambda () (k maps))
|
2156
|
+
(lambda (x maps)
|
2157
|
+
(values (gen-append x y) maps)))))))))
|
2158
|
+
((x . y)
|
2159
|
+
(call-with-values
|
2160
|
+
(lambda () (gen-syntax src #'x r maps ellipsis? mod))
|
2161
|
+
(lambda (x maps)
|
2162
|
+
(call-with-values
|
2163
|
+
(lambda () (gen-syntax src #'y r maps ellipsis? mod))
|
2164
|
+
(lambda (y maps) (values (gen-cons x y) maps))))))
|
2165
|
+
(#(e1 e2 ...)
|
2166
|
+
(call-with-values
|
2167
|
+
(lambda ()
|
2168
|
+
(gen-syntax src #'(e1 e2 ...) r maps ellipsis? mod))
|
2169
|
+
(lambda (e maps) (values (gen-vector e) maps))))
|
2170
|
+
(_ (values `(quote ,e) maps))))))
|
2171
|
+
|
2172
|
+
(define gen-ref
|
2173
|
+
(lambda (src var level maps)
|
2174
|
+
(if (fx= level 0)
|
2175
|
+
(values var maps)
|
2176
|
+
(if (null? maps)
|
2177
|
+
(syntax-violation 'syntax "missing ellipsis" src)
|
2178
|
+
(call-with-values
|
2179
|
+
(lambda () (gen-ref src var (fx- level 1) (cdr maps)))
|
2180
|
+
(lambda (outer-var outer-maps)
|
2181
|
+
(let ((b (assq outer-var (car maps))))
|
2182
|
+
(if b
|
2183
|
+
(values (cdr b) maps)
|
2184
|
+
(let ((inner-var (gen-var 'tmp)))
|
2185
|
+
(values inner-var
|
2186
|
+
(cons (cons (cons outer-var inner-var)
|
2187
|
+
(car maps))
|
2188
|
+
outer-maps)))))))))))
|
2189
|
+
|
2190
|
+
(define gen-mappend
|
2191
|
+
(lambda (e map-env)
|
2192
|
+
`(apply (primitive append) ,(gen-map e map-env))))
|
2193
|
+
|
2194
|
+
(define gen-map
|
2195
|
+
(lambda (e map-env)
|
2196
|
+
(let ((formals (map cdr map-env))
|
2197
|
+
(actuals (map (lambda (x) `(ref ,(car x))) map-env)))
|
2198
|
+
(cond
|
2199
|
+
((eq? (car e) 'ref)
|
2200
|
+
;; identity map equivalence:
|
2201
|
+
;; (map (lambda (x) x) y) == y
|
2202
|
+
(car actuals))
|
2203
|
+
((and-map
|
2204
|
+
(lambda (x) (and (eq? (car x) 'ref) (memq (cadr x) formals)))
|
2205
|
+
(cdr e))
|
2206
|
+
;; eta map equivalence:
|
2207
|
+
;; (map (lambda (x ...) (f x ...)) y ...) == (map f y ...)
|
2208
|
+
`(map (primitive ,(car e))
|
2209
|
+
,@(map (let ((r (map cons formals actuals)))
|
2210
|
+
(lambda (x) (cdr (assq (cadr x) r))))
|
2211
|
+
(cdr e))))
|
2212
|
+
(else `(map (lambda ,formals ,e) ,@actuals))))))
|
2213
|
+
|
2214
|
+
(define gen-cons
|
2215
|
+
(lambda (x y)
|
2216
|
+
(case (car y)
|
2217
|
+
((quote)
|
2218
|
+
(if (eq? (car x) 'quote)
|
2219
|
+
`(quote (,(cadr x) . ,(cadr y)))
|
2220
|
+
(if (eq? (cadr y) '())
|
2221
|
+
`(list ,x)
|
2222
|
+
`(cons ,x ,y))))
|
2223
|
+
((list) `(list ,x ,@(cdr y)))
|
2224
|
+
(else `(cons ,x ,y)))))
|
2225
|
+
|
2226
|
+
(define gen-append
|
2227
|
+
(lambda (x y)
|
2228
|
+
(if (equal? y '(quote ()))
|
2229
|
+
x
|
2230
|
+
`(append ,x ,y))))
|
2231
|
+
|
2232
|
+
(define gen-vector
|
2233
|
+
(lambda (x)
|
2234
|
+
(cond
|
2235
|
+
((eq? (car x) 'list) `(vector ,@(cdr x)))
|
2236
|
+
((eq? (car x) 'quote) `(quote #(,@(cadr x))))
|
2237
|
+
(else `(list->vector ,x)))))
|
2238
|
+
|
2239
|
+
|
2240
|
+
(define regen
|
2241
|
+
(lambda (x)
|
2242
|
+
(case (car x)
|
2243
|
+
((ref) (build-lexical-reference 'value no-source (cadr x) (cadr x)))
|
2244
|
+
((primitive) (build-primref no-source (cadr x)))
|
2245
|
+
((quote) (build-data no-source (cadr x)))
|
2246
|
+
((lambda)
|
2247
|
+
(if (list? (cadr x))
|
2248
|
+
(build-simple-lambda no-source (cadr x) #f (cadr x) '() (regen (caddr x)))
|
2249
|
+
(error "how did we get here" x)))
|
2250
|
+
(else (build-primcall no-source (car x) (map regen (cdr x)))))))
|
2251
|
+
|
2252
|
+
(lambda (e r w s mod)
|
2253
|
+
(let ((e (source-wrap e w s mod)))
|
2254
|
+
(syntax-case e ()
|
2255
|
+
((_ x)
|
2256
|
+
(call-with-values
|
2257
|
+
(lambda () (gen-syntax e #'x r '() ellipsis? mod))
|
2258
|
+
(lambda (e maps) (regen e))))
|
2259
|
+
(_ (syntax-violation 'syntax "bad `syntax' form" e)))))))
|
2260
|
+
|
2261
|
+
(global-extend 'core 'lambda
|
2262
|
+
(lambda (e r w s mod)
|
2263
|
+
(syntax-case e ()
|
2264
|
+
((_ args e1 e2 ...)
|
2265
|
+
(call-with-values (lambda () (lambda-formals #'args))
|
2266
|
+
(lambda (req opt rest kw)
|
2267
|
+
(let lp ((body #'(e1 e2 ...)) (meta '()))
|
2268
|
+
(syntax-case body ()
|
2269
|
+
((docstring e1 e2 ...) (string? (syntax->datum #'docstring))
|
2270
|
+
(lp #'(e1 e2 ...)
|
2271
|
+
(append meta
|
2272
|
+
`((documentation
|
2273
|
+
. ,(syntax->datum #'docstring))))))
|
2274
|
+
((#((k . v) ...) e1 e2 ...)
|
2275
|
+
(lp #'(e1 e2 ...)
|
2276
|
+
(append meta (syntax->datum #'((k . v) ...)))))
|
2277
|
+
(_ (expand-simple-lambda e r w s mod req rest meta body)))))))
|
2278
|
+
(_ (syntax-violation 'lambda "bad lambda" e)))))
|
2279
|
+
|
2280
|
+
(global-extend 'core 'lambda*
|
2281
|
+
(lambda (e r w s mod)
|
2282
|
+
(syntax-case e ()
|
2283
|
+
((_ args e1 e2 ...)
|
2284
|
+
(call-with-values
|
2285
|
+
(lambda ()
|
2286
|
+
(expand-lambda-case e r w s mod
|
2287
|
+
lambda*-formals #'((args e1 e2 ...))))
|
2288
|
+
(lambda (meta lcase)
|
2289
|
+
(build-case-lambda s meta lcase))))
|
2290
|
+
(_ (syntax-violation 'lambda "bad lambda*" e)))))
|
2291
|
+
|
2292
|
+
(global-extend 'core 'case-lambda
|
2293
|
+
(lambda (e r w s mod)
|
2294
|
+
(define (build-it meta clauses)
|
2295
|
+
(call-with-values
|
2296
|
+
(lambda ()
|
2297
|
+
(expand-lambda-case e r w s mod
|
2298
|
+
lambda-formals
|
2299
|
+
clauses))
|
2300
|
+
(lambda (meta* lcase)
|
2301
|
+
(build-case-lambda s (append meta meta*) lcase))))
|
2302
|
+
(syntax-case e ()
|
2303
|
+
((_ (args e1 e2 ...) ...)
|
2304
|
+
(build-it '() #'((args e1 e2 ...) ...)))
|
2305
|
+
((_ docstring (args e1 e2 ...) ...)
|
2306
|
+
(string? (syntax->datum #'docstring))
|
2307
|
+
(build-it `((documentation
|
2308
|
+
. ,(syntax->datum #'docstring)))
|
2309
|
+
#'((args e1 e2 ...) ...)))
|
2310
|
+
(_ (syntax-violation 'case-lambda "bad case-lambda" e)))))
|
2311
|
+
|
2312
|
+
(global-extend 'core 'case-lambda*
|
2313
|
+
(lambda (e r w s mod)
|
2314
|
+
(define (build-it meta clauses)
|
2315
|
+
(call-with-values
|
2316
|
+
(lambda ()
|
2317
|
+
(expand-lambda-case e r w s mod
|
2318
|
+
lambda*-formals
|
2319
|
+
clauses))
|
2320
|
+
(lambda (meta* lcase)
|
2321
|
+
(build-case-lambda s (append meta meta*) lcase))))
|
2322
|
+
(syntax-case e ()
|
2323
|
+
((_ (args e1 e2 ...) ...)
|
2324
|
+
(build-it '() #'((args e1 e2 ...) ...)))
|
2325
|
+
((_ docstring (args e1 e2 ...) ...)
|
2326
|
+
(string? (syntax->datum #'docstring))
|
2327
|
+
(build-it `((documentation
|
2328
|
+
. ,(syntax->datum #'docstring)))
|
2329
|
+
#'((args e1 e2 ...) ...)))
|
2330
|
+
(_ (syntax-violation 'case-lambda "bad case-lambda*" e)))))
|
2331
|
+
|
2332
|
+
(global-extend 'core 'with-ellipsis
|
2333
|
+
(lambda (e r w s mod)
|
2334
|
+
(syntax-case e ()
|
2335
|
+
((_ dots e1 e2 ...)
|
2336
|
+
(id? #'dots)
|
2337
|
+
(let ((id (if (symbol? #'dots)
|
2338
|
+
'#{ $sc-ellipsis }#
|
2339
|
+
(make-syntax-object '#{ $sc-ellipsis }#
|
2340
|
+
(syntax-object-wrap #'dots)
|
2341
|
+
(syntax-object-module #'dots)))))
|
2342
|
+
(let ((ids (list id))
|
2343
|
+
(labels (list (gen-label)))
|
2344
|
+
(bindings (list (make-binding 'ellipsis (source-wrap #'dots w s mod)))))
|
2345
|
+
(let ((nw (make-binding-wrap ids labels w))
|
2346
|
+
(nr (extend-env labels bindings r)))
|
2347
|
+
(expand-body #'(e1 e2 ...) (source-wrap e nw s mod) nr nw mod)))))
|
2348
|
+
(_ (syntax-violation 'with-ellipsis "bad syntax"
|
2349
|
+
(source-wrap e w s mod))))))
|
2350
|
+
|
2351
|
+
(global-extend 'core 'let
|
2352
|
+
(let ()
|
2353
|
+
(define (expand-let e r w s mod constructor ids vals exps)
|
2354
|
+
(if (not (valid-bound-ids? ids))
|
2355
|
+
(syntax-violation 'let "duplicate bound variable" e)
|
2356
|
+
(let ((labels (gen-labels ids))
|
2357
|
+
(new-vars (map gen-var ids)))
|
2358
|
+
(let ((nw (make-binding-wrap ids labels w))
|
2359
|
+
(nr (extend-var-env labels new-vars r)))
|
2360
|
+
(constructor s
|
2361
|
+
(map syntax->datum ids)
|
2362
|
+
new-vars
|
2363
|
+
(map (lambda (x) (expand x r w mod)) vals)
|
2364
|
+
(expand-body exps (source-wrap e nw s mod)
|
2365
|
+
nr nw mod))))))
|
2366
|
+
(lambda (e r w s mod)
|
2367
|
+
(syntax-case e ()
|
2368
|
+
((_ ((id val) ...) e1 e2 ...)
|
2369
|
+
(and-map id? #'(id ...))
|
2370
|
+
(expand-let e r w s mod
|
2371
|
+
build-let
|
2372
|
+
#'(id ...)
|
2373
|
+
#'(val ...)
|
2374
|
+
#'(e1 e2 ...)))
|
2375
|
+
((_ f ((id val) ...) e1 e2 ...)
|
2376
|
+
(and (id? #'f) (and-map id? #'(id ...)))
|
2377
|
+
(expand-let e r w s mod
|
2378
|
+
build-named-let
|
2379
|
+
#'(f id ...)
|
2380
|
+
#'(val ...)
|
2381
|
+
#'(e1 e2 ...)))
|
2382
|
+
(_ (syntax-violation 'let "bad let" (source-wrap e w s mod)))))))
|
2383
|
+
|
2384
|
+
|
2385
|
+
(global-extend 'core 'letrec
|
2386
|
+
(lambda (e r w s mod)
|
2387
|
+
(syntax-case e ()
|
2388
|
+
((_ ((id val) ...) e1 e2 ...)
|
2389
|
+
(and-map id? #'(id ...))
|
2390
|
+
(let ((ids #'(id ...)))
|
2391
|
+
(if (not (valid-bound-ids? ids))
|
2392
|
+
(syntax-violation 'letrec "duplicate bound variable" e)
|
2393
|
+
(let ((labels (gen-labels ids))
|
2394
|
+
(new-vars (map gen-var ids)))
|
2395
|
+
(let ((w (make-binding-wrap ids labels w))
|
2396
|
+
(r (extend-var-env labels new-vars r)))
|
2397
|
+
(build-letrec s #f
|
2398
|
+
(map syntax->datum ids)
|
2399
|
+
new-vars
|
2400
|
+
(map (lambda (x) (expand x r w mod)) #'(val ...))
|
2401
|
+
(expand-body #'(e1 e2 ...)
|
2402
|
+
(source-wrap e w s mod) r w mod)))))))
|
2403
|
+
(_ (syntax-violation 'letrec "bad letrec" (source-wrap e w s mod))))))
|
2404
|
+
|
2405
|
+
|
2406
|
+
(global-extend 'core 'letrec*
|
2407
|
+
(lambda (e r w s mod)
|
2408
|
+
(syntax-case e ()
|
2409
|
+
((_ ((id val) ...) e1 e2 ...)
|
2410
|
+
(and-map id? #'(id ...))
|
2411
|
+
(let ((ids #'(id ...)))
|
2412
|
+
(if (not (valid-bound-ids? ids))
|
2413
|
+
(syntax-violation 'letrec* "duplicate bound variable" e)
|
2414
|
+
(let ((labels (gen-labels ids))
|
2415
|
+
(new-vars (map gen-var ids)))
|
2416
|
+
(let ((w (make-binding-wrap ids labels w))
|
2417
|
+
(r (extend-var-env labels new-vars r)))
|
2418
|
+
(build-letrec s #t
|
2419
|
+
(map syntax->datum ids)
|
2420
|
+
new-vars
|
2421
|
+
(map (lambda (x) (expand x r w mod)) #'(val ...))
|
2422
|
+
(expand-body #'(e1 e2 ...)
|
2423
|
+
(source-wrap e w s mod) r w mod)))))))
|
2424
|
+
(_ (syntax-violation 'letrec* "bad letrec*" (source-wrap e w s mod))))))
|
2425
|
+
|
2426
|
+
|
2427
|
+
(global-extend
|
2428
|
+
'core 'set!
|
2429
|
+
(lambda (e r w s mod)
|
2430
|
+
(syntax-case e ()
|
2431
|
+
((_ id val)
|
2432
|
+
(id? #'id)
|
2433
|
+
(call-with-values
|
2434
|
+
(lambda () (resolve-identifier #'id w r mod #t))
|
2435
|
+
(lambda (type value id-mod)
|
2436
|
+
(case type
|
2437
|
+
((lexical)
|
2438
|
+
(build-lexical-assignment s (syntax->datum #'id) value
|
2439
|
+
(expand #'val r w mod)))
|
2440
|
+
((global)
|
2441
|
+
(build-global-assignment s value (expand #'val r w mod) id-mod))
|
2442
|
+
((macro)
|
2443
|
+
(if (procedure-property value 'variable-transformer)
|
2444
|
+
;; As syntax-type does, call expand-macro with
|
2445
|
+
;; the mod of the expression. Hmm.
|
2446
|
+
(expand (expand-macro value e r w s #f mod) r empty-wrap mod)
|
2447
|
+
(syntax-violation 'set! "not a variable transformer"
|
2448
|
+
(wrap e w mod)
|
2449
|
+
(wrap #'id w id-mod))))
|
2450
|
+
((displaced-lexical)
|
2451
|
+
(syntax-violation 'set! "identifier out of context"
|
2452
|
+
(wrap #'id w mod)))
|
2453
|
+
(else
|
2454
|
+
(syntax-violation 'set! "bad set!" (source-wrap e w s mod)))))))
|
2455
|
+
((_ (head tail ...) val)
|
2456
|
+
(call-with-values
|
2457
|
+
(lambda () (syntax-type #'head r empty-wrap no-source #f mod #t))
|
2458
|
+
(lambda (type value ee* ee ww ss modmod)
|
2459
|
+
(case type
|
2460
|
+
((module-ref)
|
2461
|
+
(let ((val (expand #'val r w mod)))
|
2462
|
+
(call-with-values (lambda () (value #'(head tail ...) r w mod))
|
2463
|
+
(lambda (e r w s* mod)
|
2464
|
+
(syntax-case e ()
|
2465
|
+
(e (id? #'e)
|
2466
|
+
(build-global-assignment s (syntax->datum #'e)
|
2467
|
+
val mod)))))))
|
2468
|
+
(else
|
2469
|
+
(build-call s
|
2470
|
+
(expand #'(setter head) r w mod)
|
2471
|
+
(map (lambda (e) (expand e r w mod))
|
2472
|
+
#'(tail ... val))))))))
|
2473
|
+
(_ (syntax-violation 'set! "bad set!" (source-wrap e w s mod))))))
|
2474
|
+
|
2475
|
+
(global-extend 'module-ref '@
|
2476
|
+
(lambda (e r w mod)
|
2477
|
+
(syntax-case e ()
|
2478
|
+
((_ (mod ...) id)
|
2479
|
+
(and (and-map id? #'(mod ...)) (id? #'id))
|
2480
|
+
;; Strip the wrap from the identifier and return top-wrap
|
2481
|
+
;; so that the identifier will not be captured by lexicals.
|
2482
|
+
(values (syntax->datum #'id) r top-wrap #f
|
2483
|
+
(syntax->datum
|
2484
|
+
#'(public mod ...)))))))
|
2485
|
+
|
2486
|
+
(global-extend 'module-ref '@@
|
2487
|
+
(lambda (e r w mod)
|
2488
|
+
(define remodulate
|
2489
|
+
(lambda (x mod)
|
2490
|
+
(cond ((pair? x)
|
2491
|
+
(cons (remodulate (car x) mod)
|
2492
|
+
(remodulate (cdr x) mod)))
|
2493
|
+
((syntax-object? x)
|
2494
|
+
(make-syntax-object
|
2495
|
+
(remodulate (syntax-object-expression x) mod)
|
2496
|
+
(syntax-object-wrap x)
|
2497
|
+
;; hither the remodulation
|
2498
|
+
mod))
|
2499
|
+
((vector? x)
|
2500
|
+
(let* ((n (vector-length x)) (v (make-vector n)))
|
2501
|
+
(do ((i 0 (fx+ i 1)))
|
2502
|
+
((fx= i n) v)
|
2503
|
+
(vector-set! v i (remodulate (vector-ref x i) mod)))))
|
2504
|
+
(else x))))
|
2505
|
+
(syntax-case e (@@ primitive)
|
2506
|
+
((_ primitive id)
|
2507
|
+
(and (id? #'id)
|
2508
|
+
(equal? (cdr (if (syntax-object? #'id)
|
2509
|
+
(syntax-object-module #'id)
|
2510
|
+
mod))
|
2511
|
+
'(guile)))
|
2512
|
+
;; Strip the wrap from the identifier and return top-wrap
|
2513
|
+
;; so that the identifier will not be captured by lexicals.
|
2514
|
+
(values (syntax->datum #'id) r top-wrap #f '(primitive)))
|
2515
|
+
((_ (mod ...) id)
|
2516
|
+
(and (and-map id? #'(mod ...)) (id? #'id))
|
2517
|
+
;; Strip the wrap from the identifier and return top-wrap
|
2518
|
+
;; so that the identifier will not be captured by lexicals.
|
2519
|
+
(values (syntax->datum #'id) r top-wrap #f
|
2520
|
+
(syntax->datum
|
2521
|
+
#'(private mod ...))))
|
2522
|
+
((_ @@ (mod ...) exp)
|
2523
|
+
(and-map id? #'(mod ...))
|
2524
|
+
;; This is a special syntax used to support R6RS library forms.
|
2525
|
+
;; Unlike the syntax above, the last item is not restricted to
|
2526
|
+
;; be a single identifier, and the syntax objects are kept
|
2527
|
+
;; intact, with only their module changed.
|
2528
|
+
(let ((mod (syntax->datum #'(private mod ...))))
|
2529
|
+
(values (remodulate #'exp mod)
|
2530
|
+
r w (source-annotation #'exp)
|
2531
|
+
mod))))))
|
2532
|
+
|
2533
|
+
(global-extend 'core 'if
|
2534
|
+
(lambda (e r w s mod)
|
2535
|
+
(syntax-case e ()
|
2536
|
+
((_ test then)
|
2537
|
+
(build-conditional
|
2538
|
+
s
|
2539
|
+
(expand #'test r w mod)
|
2540
|
+
(expand #'then r w mod)
|
2541
|
+
(build-void no-source)))
|
2542
|
+
((_ test then else)
|
2543
|
+
(build-conditional
|
2544
|
+
s
|
2545
|
+
(expand #'test r w mod)
|
2546
|
+
(expand #'then r w mod)
|
2547
|
+
(expand #'else r w mod))))))
|
2548
|
+
|
2549
|
+
(global-extend 'begin 'begin '())
|
2550
|
+
|
2551
|
+
(global-extend 'define 'define '())
|
2552
|
+
|
2553
|
+
(global-extend 'define-syntax 'define-syntax '())
|
2554
|
+
(global-extend 'define-syntax-parameter 'define-syntax-parameter '())
|
2555
|
+
|
2556
|
+
(global-extend 'eval-when 'eval-when '())
|
2557
|
+
|
2558
|
+
(global-extend 'core 'syntax-case
|
2559
|
+
(let ()
|
2560
|
+
(define convert-pattern
|
2561
|
+
;; accepts pattern & keys
|
2562
|
+
;; returns $sc-dispatch pattern & ids
|
2563
|
+
(lambda (pattern keys ellipsis?)
|
2564
|
+
(define cvt*
|
2565
|
+
(lambda (p* n ids)
|
2566
|
+
(syntax-case p* ()
|
2567
|
+
((x . y)
|
2568
|
+
(call-with-values
|
2569
|
+
(lambda () (cvt* #'y n ids))
|
2570
|
+
(lambda (y ids)
|
2571
|
+
(call-with-values
|
2572
|
+
(lambda () (cvt #'x n ids))
|
2573
|
+
(lambda (x ids)
|
2574
|
+
(values (cons x y) ids))))))
|
2575
|
+
(_ (cvt p* n ids)))))
|
2576
|
+
|
2577
|
+
(define (v-reverse x)
|
2578
|
+
(let loop ((r '()) (x x))
|
2579
|
+
(if (not (pair? x))
|
2580
|
+
(values r x)
|
2581
|
+
(loop (cons (car x) r) (cdr x)))))
|
2582
|
+
|
2583
|
+
(define cvt
|
2584
|
+
(lambda (p n ids)
|
2585
|
+
(if (id? p)
|
2586
|
+
(cond
|
2587
|
+
((bound-id-member? p keys)
|
2588
|
+
(values (vector 'free-id p) ids))
|
2589
|
+
((free-id=? p #'_)
|
2590
|
+
(values '_ ids))
|
2591
|
+
(else
|
2592
|
+
(values 'any (cons (cons p n) ids))))
|
2593
|
+
(syntax-case p ()
|
2594
|
+
((x dots)
|
2595
|
+
(ellipsis? (syntax dots))
|
2596
|
+
(call-with-values
|
2597
|
+
(lambda () (cvt (syntax x) (fx+ n 1) ids))
|
2598
|
+
(lambda (p ids)
|
2599
|
+
(values (if (eq? p 'any) 'each-any (vector 'each p))
|
2600
|
+
ids))))
|
2601
|
+
((x dots . ys)
|
2602
|
+
(ellipsis? (syntax dots))
|
2603
|
+
(call-with-values
|
2604
|
+
(lambda () (cvt* (syntax ys) n ids))
|
2605
|
+
(lambda (ys ids)
|
2606
|
+
(call-with-values
|
2607
|
+
(lambda () (cvt (syntax x) (+ n 1) ids))
|
2608
|
+
(lambda (x ids)
|
2609
|
+
(call-with-values
|
2610
|
+
(lambda () (v-reverse ys))
|
2611
|
+
(lambda (ys e)
|
2612
|
+
(values `#(each+ ,x ,ys ,e)
|
2613
|
+
ids))))))))
|
2614
|
+
((x . y)
|
2615
|
+
(call-with-values
|
2616
|
+
(lambda () (cvt (syntax y) n ids))
|
2617
|
+
(lambda (y ids)
|
2618
|
+
(call-with-values
|
2619
|
+
(lambda () (cvt (syntax x) n ids))
|
2620
|
+
(lambda (x ids)
|
2621
|
+
(values (cons x y) ids))))))
|
2622
|
+
(() (values '() ids))
|
2623
|
+
(#(x ...)
|
2624
|
+
(call-with-values
|
2625
|
+
(lambda () (cvt (syntax (x ...)) n ids))
|
2626
|
+
(lambda (p ids) (values (vector 'vector p) ids))))
|
2627
|
+
(x (values (vector 'atom (strip p empty-wrap)) ids))))))
|
2628
|
+
(cvt pattern 0 '())))
|
2629
|
+
|
2630
|
+
(define build-dispatch-call
|
2631
|
+
(lambda (pvars exp y r mod)
|
2632
|
+
(let ((ids (map car pvars)) (levels (map cdr pvars)))
|
2633
|
+
(let ((labels (gen-labels ids)) (new-vars (map gen-var ids)))
|
2634
|
+
(build-primcall
|
2635
|
+
no-source
|
2636
|
+
'apply
|
2637
|
+
(list (build-simple-lambda no-source (map syntax->datum ids) #f new-vars '()
|
2638
|
+
(expand exp
|
2639
|
+
(extend-env
|
2640
|
+
labels
|
2641
|
+
(map (lambda (var level)
|
2642
|
+
(make-binding 'syntax `(,var . ,level)))
|
2643
|
+
new-vars
|
2644
|
+
(map cdr pvars))
|
2645
|
+
r)
|
2646
|
+
(make-binding-wrap ids labels empty-wrap)
|
2647
|
+
mod))
|
2648
|
+
y))))))
|
2649
|
+
|
2650
|
+
(define gen-clause
|
2651
|
+
(lambda (x keys clauses r pat fender exp mod)
|
2652
|
+
(call-with-values
|
2653
|
+
(lambda () (convert-pattern pat keys (lambda (e) (ellipsis? e r mod))))
|
2654
|
+
(lambda (p pvars)
|
2655
|
+
(cond
|
2656
|
+
((not (and-map (lambda (x) (not (ellipsis? (car x) r mod))) pvars))
|
2657
|
+
(syntax-violation 'syntax-case "misplaced ellipsis" pat))
|
2658
|
+
((not (distinct-bound-ids? (map car pvars)))
|
2659
|
+
(syntax-violation 'syntax-case "duplicate pattern variable" pat))
|
2660
|
+
(else
|
2661
|
+
(let ((y (gen-var 'tmp)))
|
2662
|
+
;; fat finger binding and references to temp variable y
|
2663
|
+
(build-call no-source
|
2664
|
+
(build-simple-lambda no-source (list 'tmp) #f (list y) '()
|
2665
|
+
(let ((y (build-lexical-reference 'value no-source
|
2666
|
+
'tmp y)))
|
2667
|
+
(build-conditional no-source
|
2668
|
+
(syntax-case fender ()
|
2669
|
+
(#t y)
|
2670
|
+
(_ (build-conditional no-source
|
2671
|
+
y
|
2672
|
+
(build-dispatch-call pvars fender y r mod)
|
2673
|
+
(build-data no-source #f))))
|
2674
|
+
(build-dispatch-call pvars exp y r mod)
|
2675
|
+
(gen-syntax-case x keys clauses r mod))))
|
2676
|
+
(list (if (eq? p 'any)
|
2677
|
+
(build-primcall no-source 'list (list x))
|
2678
|
+
(build-primcall no-source '$sc-dispatch
|
2679
|
+
(list x (build-data no-source p)))))))))))))
|
2680
|
+
|
2681
|
+
(define gen-syntax-case
|
2682
|
+
(lambda (x keys clauses r mod)
|
2683
|
+
(if (null? clauses)
|
2684
|
+
(build-primcall no-source 'syntax-violation
|
2685
|
+
(list (build-data no-source #f)
|
2686
|
+
(build-data no-source
|
2687
|
+
"source expression failed to match any pattern")
|
2688
|
+
x))
|
2689
|
+
(syntax-case (car clauses) ()
|
2690
|
+
((pat exp)
|
2691
|
+
(if (and (id? #'pat)
|
2692
|
+
(and-map (lambda (x) (not (free-id=? #'pat x)))
|
2693
|
+
(cons #'(... ...) keys)))
|
2694
|
+
(if (free-id=? #'pat #'_)
|
2695
|
+
(expand #'exp r empty-wrap mod)
|
2696
|
+
(let ((labels (list (gen-label)))
|
2697
|
+
(var (gen-var #'pat)))
|
2698
|
+
(build-call no-source
|
2699
|
+
(build-simple-lambda
|
2700
|
+
no-source (list (syntax->datum #'pat)) #f (list var)
|
2701
|
+
'()
|
2702
|
+
(expand #'exp
|
2703
|
+
(extend-env labels
|
2704
|
+
(list (make-binding 'syntax `(,var . 0)))
|
2705
|
+
r)
|
2706
|
+
(make-binding-wrap #'(pat)
|
2707
|
+
labels empty-wrap)
|
2708
|
+
mod))
|
2709
|
+
(list x))))
|
2710
|
+
(gen-clause x keys (cdr clauses) r
|
2711
|
+
#'pat #t #'exp mod)))
|
2712
|
+
((pat fender exp)
|
2713
|
+
(gen-clause x keys (cdr clauses) r
|
2714
|
+
#'pat #'fender #'exp mod))
|
2715
|
+
(_ (syntax-violation 'syntax-case "invalid clause"
|
2716
|
+
(car clauses)))))))
|
2717
|
+
|
2718
|
+
(lambda (e r w s mod)
|
2719
|
+
(let ((e (source-wrap e w s mod)))
|
2720
|
+
(syntax-case e ()
|
2721
|
+
((_ val (key ...) m ...)
|
2722
|
+
(if (and-map (lambda (x) (and (id? x) (not (ellipsis? x r mod))))
|
2723
|
+
#'(key ...))
|
2724
|
+
(let ((x (gen-var 'tmp)))
|
2725
|
+
;; fat finger binding and references to temp variable x
|
2726
|
+
(build-call s
|
2727
|
+
(build-simple-lambda no-source (list 'tmp) #f (list x) '()
|
2728
|
+
(gen-syntax-case (build-lexical-reference 'value no-source
|
2729
|
+
'tmp x)
|
2730
|
+
#'(key ...) #'(m ...)
|
2731
|
+
r
|
2732
|
+
mod))
|
2733
|
+
(list (expand #'val r empty-wrap mod))))
|
2734
|
+
(syntax-violation 'syntax-case "invalid literals list" e))))))))
|
2735
|
+
|
2736
|
+
;; The portable macroexpand seeds expand-top's mode m with 'e (for
|
2737
|
+
;; evaluating) and esew (which stands for "eval syntax expanders
|
2738
|
+
;; when") with '(eval). In Chez Scheme, m is set to 'c instead of e
|
2739
|
+
;; if we are compiling a file, and esew is set to
|
2740
|
+
;; (eval-syntactic-expanders-when), which defaults to the list
|
2741
|
+
;; '(compile load eval). This means that, by default, top-level
|
2742
|
+
;; syntactic definitions are evaluated immediately after they are
|
2743
|
+
;; expanded, and the expanded definitions are also residualized into
|
2744
|
+
;; the object file if we are compiling a file.
|
2745
|
+
(set! macroexpand
|
2746
|
+
(lambda* (x #:optional (m 'e) (esew '(eval)))
|
2747
|
+
(expand-top-sequence (list x) null-env top-wrap #f m esew
|
2748
|
+
(cons 'hygiene (module-name (current-module))))))
|
2749
|
+
|
2750
|
+
(set! identifier?
|
2751
|
+
(lambda (x)
|
2752
|
+
(nonsymbol-id? x)))
|
2753
|
+
|
2754
|
+
(set! datum->syntax
|
2755
|
+
(lambda (id datum)
|
2756
|
+
(make-syntax-object datum (syntax-object-wrap id)
|
2757
|
+
(syntax-object-module id))))
|
2758
|
+
|
2759
|
+
(set! syntax->datum
|
2760
|
+
;; accepts any object, since syntax objects may consist partially
|
2761
|
+
;; or entirely of unwrapped, nonsymbolic data
|
2762
|
+
(lambda (x)
|
2763
|
+
(strip x empty-wrap)))
|
2764
|
+
|
2765
|
+
(set! syntax-source
|
2766
|
+
(lambda (x) (source-annotation x)))
|
2767
|
+
|
2768
|
+
(set! generate-temporaries
|
2769
|
+
(lambda (ls)
|
2770
|
+
(arg-check list? ls 'generate-temporaries)
|
2771
|
+
(let ((mod (cons 'hygiene (module-name (current-module)))))
|
2772
|
+
(map (lambda (x)
|
2773
|
+
(wrap (module-gensym "t") top-wrap mod))
|
2774
|
+
ls))))
|
2775
|
+
|
2776
|
+
(set! free-identifier=?
|
2777
|
+
(lambda (x y)
|
2778
|
+
(arg-check nonsymbol-id? x 'free-identifier=?)
|
2779
|
+
(arg-check nonsymbol-id? y 'free-identifier=?)
|
2780
|
+
(free-id=? x y)))
|
2781
|
+
|
2782
|
+
(set! bound-identifier=?
|
2783
|
+
(lambda (x y)
|
2784
|
+
(arg-check nonsymbol-id? x 'bound-identifier=?)
|
2785
|
+
(arg-check nonsymbol-id? y 'bound-identifier=?)
|
2786
|
+
(bound-id=? x y)))
|
2787
|
+
|
2788
|
+
(set! syntax-violation
|
2789
|
+
(lambda* (who message form #:optional subform)
|
2790
|
+
(arg-check (lambda (x) (or (not x) (string? x) (symbol? x)))
|
2791
|
+
who 'syntax-violation)
|
2792
|
+
(arg-check string? message 'syntax-violation)
|
2793
|
+
(throw 'syntax-error who message
|
2794
|
+
(or (source-annotation subform)
|
2795
|
+
(source-annotation form))
|
2796
|
+
(strip form empty-wrap)
|
2797
|
+
(and subform (strip subform empty-wrap)))))
|
2798
|
+
|
2799
|
+
(let ()
|
2800
|
+
(define (%syntax-module id)
|
2801
|
+
(arg-check nonsymbol-id? id 'syntax-module)
|
2802
|
+
(let ((mod (syntax-object-module id)))
|
2803
|
+
(and (not (equal? mod '(primitive)))
|
2804
|
+
(cdr mod))))
|
2805
|
+
|
2806
|
+
(define* (syntax-local-binding id #:key (resolve-syntax-parameters? #t))
|
2807
|
+
(arg-check nonsymbol-id? id 'syntax-local-binding)
|
2808
|
+
(with-transformer-environment
|
2809
|
+
(lambda (e r w s rib mod)
|
2810
|
+
(define (strip-anti-mark w)
|
2811
|
+
(let ((ms (wrap-marks w)) (s (wrap-subst w)))
|
2812
|
+
(if (and (pair? ms) (eq? (car ms) the-anti-mark))
|
2813
|
+
;; output is from original text
|
2814
|
+
(make-wrap (cdr ms) (if rib (cons rib (cdr s)) (cdr s)))
|
2815
|
+
;; output introduced by macro
|
2816
|
+
(make-wrap ms (if rib (cons rib s) s)))))
|
2817
|
+
(call-with-values (lambda ()
|
2818
|
+
(resolve-identifier
|
2819
|
+
(syntax-object-expression id)
|
2820
|
+
(strip-anti-mark (syntax-object-wrap id))
|
2821
|
+
r
|
2822
|
+
(syntax-object-module id)
|
2823
|
+
resolve-syntax-parameters?))
|
2824
|
+
(lambda (type value mod)
|
2825
|
+
(case type
|
2826
|
+
((lexical) (values 'lexical value))
|
2827
|
+
((macro) (values 'macro value))
|
2828
|
+
((syntax-parameter) (values 'syntax-parameter value))
|
2829
|
+
((syntax) (values 'pattern-variable value))
|
2830
|
+
((displaced-lexical) (values 'displaced-lexical #f))
|
2831
|
+
((global)
|
2832
|
+
(if (equal? mod '(primitive))
|
2833
|
+
(values 'primitive value)
|
2834
|
+
(values 'global (cons value (cdr mod)))))
|
2835
|
+
((ellipsis)
|
2836
|
+
(values 'ellipsis
|
2837
|
+
(make-syntax-object (syntax-object-expression value)
|
2838
|
+
(anti-mark (syntax-object-wrap value))
|
2839
|
+
(syntax-object-module value))))
|
2840
|
+
(else (values 'other #f))))))))
|
2841
|
+
|
2842
|
+
(define (syntax-locally-bound-identifiers id)
|
2843
|
+
(arg-check nonsymbol-id? id 'syntax-locally-bound-identifiers)
|
2844
|
+
(locally-bound-identifiers (syntax-object-wrap id)
|
2845
|
+
(syntax-object-module id)))
|
2846
|
+
|
2847
|
+
;; Using define! instead of set! to avoid warnings at
|
2848
|
+
;; compile-time, after the variables are stolen away into (system
|
2849
|
+
;; syntax). See the end of boot-9.scm.
|
2850
|
+
;;
|
2851
|
+
(define! '%syntax-module %syntax-module)
|
2852
|
+
(define! 'syntax-local-binding syntax-local-binding)
|
2853
|
+
(define! 'syntax-locally-bound-identifiers syntax-locally-bound-identifiers))
|
2854
|
+
|
2855
|
+
;; $sc-dispatch expects an expression and a pattern. If the expression
|
2856
|
+
;; matches the pattern a list of the matching expressions for each
|
2857
|
+
;; "any" is returned. Otherwise, #f is returned. (This use of #f will
|
2858
|
+
;; not work on r4rs implementations that violate the ieee requirement
|
2859
|
+
;; that #f and () be distinct.)
|
2860
|
+
|
2861
|
+
;; The expression is matched with the pattern as follows:
|
2862
|
+
|
2863
|
+
;; pattern: matches:
|
2864
|
+
;; () empty list
|
2865
|
+
;; any anything
|
2866
|
+
;; (<pattern>1 . <pattern>2) (<pattern>1 . <pattern>2)
|
2867
|
+
;; each-any (any*)
|
2868
|
+
;; #(free-id <key>) <key> with free-identifier=?
|
2869
|
+
;; #(each <pattern>) (<pattern>*)
|
2870
|
+
;; #(each+ p1 (p2_1 ... p2_n) p3) (p1* (p2_n ... p2_1) . p3)
|
2871
|
+
;; #(vector <pattern>) (list->vector <pattern>)
|
2872
|
+
;; #(atom <object>) <object> with "equal?"
|
2873
|
+
|
2874
|
+
;; Vector cops out to pair under assumption that vectors are rare. If
|
2875
|
+
;; not, should convert to:
|
2876
|
+
;; #(vector <pattern>*) #(<pattern>*)
|
2877
|
+
|
2878
|
+
(let ()
|
2879
|
+
|
2880
|
+
(define match-each
|
2881
|
+
(lambda (e p w mod)
|
2882
|
+
(cond
|
2883
|
+
((pair? e)
|
2884
|
+
(let ((first (match (car e) p w '() mod)))
|
2885
|
+
(and first
|
2886
|
+
(let ((rest (match-each (cdr e) p w mod)))
|
2887
|
+
(and rest (cons first rest))))))
|
2888
|
+
((null? e) '())
|
2889
|
+
((syntax-object? e)
|
2890
|
+
(match-each (syntax-object-expression e)
|
2891
|
+
p
|
2892
|
+
(join-wraps w (syntax-object-wrap e))
|
2893
|
+
(syntax-object-module e)))
|
2894
|
+
(else #f))))
|
2895
|
+
|
2896
|
+
(define match-each+
|
2897
|
+
(lambda (e x-pat y-pat z-pat w r mod)
|
2898
|
+
(let f ((e e) (w w))
|
2899
|
+
(cond
|
2900
|
+
((pair? e)
|
2901
|
+
(call-with-values (lambda () (f (cdr e) w))
|
2902
|
+
(lambda (xr* y-pat r)
|
2903
|
+
(if r
|
2904
|
+
(if (null? y-pat)
|
2905
|
+
(let ((xr (match (car e) x-pat w '() mod)))
|
2906
|
+
(if xr
|
2907
|
+
(values (cons xr xr*) y-pat r)
|
2908
|
+
(values #f #f #f)))
|
2909
|
+
(values
|
2910
|
+
'()
|
2911
|
+
(cdr y-pat)
|
2912
|
+
(match (car e) (car y-pat) w r mod)))
|
2913
|
+
(values #f #f #f)))))
|
2914
|
+
((syntax-object? e)
|
2915
|
+
(f (syntax-object-expression e)
|
2916
|
+
(join-wraps w (syntax-object-wrap e))))
|
2917
|
+
(else
|
2918
|
+
(values '() y-pat (match e z-pat w r mod)))))))
|
2919
|
+
|
2920
|
+
(define match-each-any
|
2921
|
+
(lambda (e w mod)
|
2922
|
+
(cond
|
2923
|
+
((pair? e)
|
2924
|
+
(let ((l (match-each-any (cdr e) w mod)))
|
2925
|
+
(and l (cons (wrap (car e) w mod) l))))
|
2926
|
+
((null? e) '())
|
2927
|
+
((syntax-object? e)
|
2928
|
+
(match-each-any (syntax-object-expression e)
|
2929
|
+
(join-wraps w (syntax-object-wrap e))
|
2930
|
+
mod))
|
2931
|
+
(else #f))))
|
2932
|
+
|
2933
|
+
(define match-empty
|
2934
|
+
(lambda (p r)
|
2935
|
+
(cond
|
2936
|
+
((null? p) r)
|
2937
|
+
((eq? p '_) r)
|
2938
|
+
((eq? p 'any) (cons '() r))
|
2939
|
+
((pair? p) (match-empty (car p) (match-empty (cdr p) r)))
|
2940
|
+
((eq? p 'each-any) (cons '() r))
|
2941
|
+
(else
|
2942
|
+
(case (vector-ref p 0)
|
2943
|
+
((each) (match-empty (vector-ref p 1) r))
|
2944
|
+
((each+) (match-empty (vector-ref p 1)
|
2945
|
+
(match-empty
|
2946
|
+
(reverse (vector-ref p 2))
|
2947
|
+
(match-empty (vector-ref p 3) r))))
|
2948
|
+
((free-id atom) r)
|
2949
|
+
((vector) (match-empty (vector-ref p 1) r)))))))
|
2950
|
+
|
2951
|
+
(define combine
|
2952
|
+
(lambda (r* r)
|
2953
|
+
(if (null? (car r*))
|
2954
|
+
r
|
2955
|
+
(cons (map car r*) (combine (map cdr r*) r)))))
|
2956
|
+
|
2957
|
+
(define match*
|
2958
|
+
(lambda (e p w r mod)
|
2959
|
+
(cond
|
2960
|
+
((null? p) (and (null? e) r))
|
2961
|
+
((pair? p)
|
2962
|
+
(and (pair? e) (match (car e) (car p) w
|
2963
|
+
(match (cdr e) (cdr p) w r mod)
|
2964
|
+
mod)))
|
2965
|
+
((eq? p 'each-any)
|
2966
|
+
(let ((l (match-each-any e w mod))) (and l (cons l r))))
|
2967
|
+
(else
|
2968
|
+
(case (vector-ref p 0)
|
2969
|
+
((each)
|
2970
|
+
(if (null? e)
|
2971
|
+
(match-empty (vector-ref p 1) r)
|
2972
|
+
(let ((l (match-each e (vector-ref p 1) w mod)))
|
2973
|
+
(and l
|
2974
|
+
(let collect ((l l))
|
2975
|
+
(if (null? (car l))
|
2976
|
+
r
|
2977
|
+
(cons (map car l) (collect (map cdr l)))))))))
|
2978
|
+
((each+)
|
2979
|
+
(call-with-values
|
2980
|
+
(lambda ()
|
2981
|
+
(match-each+ e (vector-ref p 1) (vector-ref p 2) (vector-ref p 3) w r mod))
|
2982
|
+
(lambda (xr* y-pat r)
|
2983
|
+
(and r
|
2984
|
+
(null? y-pat)
|
2985
|
+
(if (null? xr*)
|
2986
|
+
(match-empty (vector-ref p 1) r)
|
2987
|
+
(combine xr* r))))))
|
2988
|
+
((free-id) (and (id? e) (free-id=? (wrap e w mod) (vector-ref p 1)) r))
|
2989
|
+
((atom) (and (equal? (vector-ref p 1) (strip e w)) r))
|
2990
|
+
((vector)
|
2991
|
+
(and (vector? e)
|
2992
|
+
(match (vector->list e) (vector-ref p 1) w r mod))))))))
|
2993
|
+
|
2994
|
+
(define match
|
2995
|
+
(lambda (e p w r mod)
|
2996
|
+
(cond
|
2997
|
+
((not r) #f)
|
2998
|
+
((eq? p '_) r)
|
2999
|
+
((eq? p 'any) (cons (wrap e w mod) r))
|
3000
|
+
((syntax-object? e)
|
3001
|
+
(match*
|
3002
|
+
(syntax-object-expression e)
|
3003
|
+
p
|
3004
|
+
(join-wraps w (syntax-object-wrap e))
|
3005
|
+
r
|
3006
|
+
(syntax-object-module e)))
|
3007
|
+
(else (match* e p w r mod)))))
|
3008
|
+
|
3009
|
+
(set! $sc-dispatch
|
3010
|
+
(lambda (e p)
|
3011
|
+
(cond
|
3012
|
+
((eq? p 'any) (list e))
|
3013
|
+
((eq? p '_) '())
|
3014
|
+
((syntax-object? e)
|
3015
|
+
(match* (syntax-object-expression e)
|
3016
|
+
p (syntax-object-wrap e) '() (syntax-object-module e)))
|
3017
|
+
(else (match* e p empty-wrap '() #f))))))))
|
3018
|
+
|
3019
|
+
|
3020
|
+
(define-syntax with-syntax
|
3021
|
+
(lambda (x)
|
3022
|
+
(syntax-case x ()
|
3023
|
+
((_ () e1 e2 ...)
|
3024
|
+
#'(let () e1 e2 ...))
|
3025
|
+
((_ ((out in)) e1 e2 ...)
|
3026
|
+
#'(syntax-case in ()
|
3027
|
+
(out (let () e1 e2 ...))))
|
3028
|
+
((_ ((out in) ...) e1 e2 ...)
|
3029
|
+
#'(syntax-case (list in ...) ()
|
3030
|
+
((out ...) (let () e1 e2 ...)))))))
|
3031
|
+
|
3032
|
+
(define-syntax syntax-error
|
3033
|
+
(lambda (x)
|
3034
|
+
(syntax-case x ()
|
3035
|
+
;; Extended internal syntax which provides the original form
|
3036
|
+
;; as the first operand, for improved error reporting.
|
3037
|
+
((_ (keyword . operands) message arg ...)
|
3038
|
+
(string? (syntax->datum #'message))
|
3039
|
+
(syntax-violation (syntax->datum #'keyword)
|
3040
|
+
(string-join (cons (syntax->datum #'message)
|
3041
|
+
(map (lambda (x)
|
3042
|
+
(object->string
|
3043
|
+
(syntax->datum x)))
|
3044
|
+
#'(arg ...))))
|
3045
|
+
(and (syntax->datum #'keyword)
|
3046
|
+
#'(keyword . operands))))
|
3047
|
+
;; Standard R7RS syntax
|
3048
|
+
((_ message arg ...)
|
3049
|
+
(string? (syntax->datum #'message))
|
3050
|
+
#'(syntax-error (#f) message arg ...)))))
|
3051
|
+
|
3052
|
+
(define-syntax syntax-rules
|
3053
|
+
(lambda (xx)
|
3054
|
+
(define (expand-clause clause)
|
3055
|
+
;; Convert a 'syntax-rules' clause into a 'syntax-case' clause.
|
3056
|
+
(syntax-case clause (syntax-error)
|
3057
|
+
;; If the template is a 'syntax-error' form, use the extended
|
3058
|
+
;; internal syntax, which adds the original form as the first
|
3059
|
+
;; operand for improved error reporting.
|
3060
|
+
(((keyword . pattern) (syntax-error message arg ...))
|
3061
|
+
(string? (syntax->datum #'message))
|
3062
|
+
#'((dummy . pattern) #'(syntax-error (dummy . pattern) message arg ...)))
|
3063
|
+
;; Normal case
|
3064
|
+
(((keyword . pattern) template)
|
3065
|
+
#'((dummy . pattern) #'template))))
|
3066
|
+
(define (expand-syntax-rules dots keys docstrings clauses)
|
3067
|
+
(with-syntax
|
3068
|
+
(((k ...) keys)
|
3069
|
+
((docstring ...) docstrings)
|
3070
|
+
((((keyword . pattern) template) ...) clauses)
|
3071
|
+
((clause ...) (map expand-clause clauses)))
|
3072
|
+
(with-syntax
|
3073
|
+
((form #'(lambda (x)
|
3074
|
+
docstring ... ; optional docstring
|
3075
|
+
#((macro-type . syntax-rules)
|
3076
|
+
(patterns pattern ...)) ; embed patterns as procedure metadata
|
3077
|
+
(syntax-case x (k ...)
|
3078
|
+
clause ...))))
|
3079
|
+
(if dots
|
3080
|
+
(with-syntax ((dots dots))
|
3081
|
+
#'(with-ellipsis dots form))
|
3082
|
+
#'form))))
|
3083
|
+
(syntax-case xx ()
|
3084
|
+
((_ (k ...) ((keyword . pattern) template) ...)
|
3085
|
+
(expand-syntax-rules #f #'(k ...) #'() #'(((keyword . pattern) template) ...)))
|
3086
|
+
((_ (k ...) docstring ((keyword . pattern) template) ...)
|
3087
|
+
(string? (syntax->datum #'docstring))
|
3088
|
+
(expand-syntax-rules #f #'(k ...) #'(docstring) #'(((keyword . pattern) template) ...)))
|
3089
|
+
((_ dots (k ...) ((keyword . pattern) template) ...)
|
3090
|
+
(identifier? #'dots)
|
3091
|
+
(expand-syntax-rules #'dots #'(k ...) #'() #'(((keyword . pattern) template) ...)))
|
3092
|
+
((_ dots (k ...) docstring ((keyword . pattern) template) ...)
|
3093
|
+
(and (identifier? #'dots) (string? (syntax->datum #'docstring)))
|
3094
|
+
(expand-syntax-rules #'dots #'(k ...) #'(docstring) #'(((keyword . pattern) template) ...))))))
|
3095
|
+
|
3096
|
+
(define-syntax define-syntax-rule
|
3097
|
+
(lambda (x)
|
3098
|
+
(syntax-case x ()
|
3099
|
+
((_ (name . pattern) template)
|
3100
|
+
#'(define-syntax name
|
3101
|
+
(syntax-rules ()
|
3102
|
+
((_ . pattern) template))))
|
3103
|
+
((_ (name . pattern) docstring template)
|
3104
|
+
(string? (syntax->datum #'docstring))
|
3105
|
+
#'(define-syntax name
|
3106
|
+
(syntax-rules ()
|
3107
|
+
docstring
|
3108
|
+
((_ . pattern) template)))))))
|
3109
|
+
|
3110
|
+
(define-syntax let*
|
3111
|
+
(lambda (x)
|
3112
|
+
(syntax-case x ()
|
3113
|
+
((let* ((x v) ...) e1 e2 ...)
|
3114
|
+
(and-map identifier? #'(x ...))
|
3115
|
+
(let f ((bindings #'((x v) ...)))
|
3116
|
+
(if (null? bindings)
|
3117
|
+
#'(let () e1 e2 ...)
|
3118
|
+
(with-syntax ((body (f (cdr bindings)))
|
3119
|
+
(binding (car bindings)))
|
3120
|
+
#'(let (binding) body))))))))
|
3121
|
+
|
3122
|
+
(define-syntax quasiquote
|
3123
|
+
(let ()
|
3124
|
+
(define (quasi p lev)
|
3125
|
+
(syntax-case p (unquote quasiquote)
|
3126
|
+
((unquote p)
|
3127
|
+
(if (= lev 0)
|
3128
|
+
#'("value" p)
|
3129
|
+
(quasicons #'("quote" unquote) (quasi #'(p) (- lev 1)))))
|
3130
|
+
((quasiquote p) (quasicons #'("quote" quasiquote) (quasi #'(p) (+ lev 1))))
|
3131
|
+
((p . q)
|
3132
|
+
(syntax-case #'p (unquote unquote-splicing)
|
3133
|
+
((unquote p ...)
|
3134
|
+
(if (= lev 0)
|
3135
|
+
(quasilist* #'(("value" p) ...) (quasi #'q lev))
|
3136
|
+
(quasicons
|
3137
|
+
(quasicons #'("quote" unquote) (quasi #'(p ...) (- lev 1)))
|
3138
|
+
(quasi #'q lev))))
|
3139
|
+
((unquote-splicing p ...)
|
3140
|
+
(if (= lev 0)
|
3141
|
+
(quasiappend #'(("value" p) ...) (quasi #'q lev))
|
3142
|
+
(quasicons
|
3143
|
+
(quasicons #'("quote" unquote-splicing) (quasi #'(p ...) (- lev 1)))
|
3144
|
+
(quasi #'q lev))))
|
3145
|
+
(_ (quasicons (quasi #'p lev) (quasi #'q lev)))))
|
3146
|
+
(#(x ...) (quasivector (vquasi #'(x ...) lev)))
|
3147
|
+
(p #'("quote" p))))
|
3148
|
+
(define (vquasi p lev)
|
3149
|
+
(syntax-case p ()
|
3150
|
+
((p . q)
|
3151
|
+
(syntax-case #'p (unquote unquote-splicing)
|
3152
|
+
((unquote p ...)
|
3153
|
+
(if (= lev 0)
|
3154
|
+
(quasilist* #'(("value" p) ...) (vquasi #'q lev))
|
3155
|
+
(quasicons
|
3156
|
+
(quasicons #'("quote" unquote) (quasi #'(p ...) (- lev 1)))
|
3157
|
+
(vquasi #'q lev))))
|
3158
|
+
((unquote-splicing p ...)
|
3159
|
+
(if (= lev 0)
|
3160
|
+
(quasiappend #'(("value" p) ...) (vquasi #'q lev))
|
3161
|
+
(quasicons
|
3162
|
+
(quasicons
|
3163
|
+
#'("quote" unquote-splicing)
|
3164
|
+
(quasi #'(p ...) (- lev 1)))
|
3165
|
+
(vquasi #'q lev))))
|
3166
|
+
(_ (quasicons (quasi #'p lev) (vquasi #'q lev)))))
|
3167
|
+
(() #'("quote" ()))))
|
3168
|
+
(define (quasicons x y)
|
3169
|
+
(with-syntax ((x x) (y y))
|
3170
|
+
(syntax-case #'y ()
|
3171
|
+
(("quote" dy)
|
3172
|
+
(syntax-case #'x ()
|
3173
|
+
(("quote" dx) #'("quote" (dx . dy)))
|
3174
|
+
(_ (if (null? #'dy) #'("list" x) #'("list*" x y)))))
|
3175
|
+
(("list" . stuff) #'("list" x . stuff))
|
3176
|
+
(("list*" . stuff) #'("list*" x . stuff))
|
3177
|
+
(_ #'("list*" x y)))))
|
3178
|
+
(define (quasiappend x y)
|
3179
|
+
(syntax-case y ()
|
3180
|
+
(("quote" ())
|
3181
|
+
(cond
|
3182
|
+
((null? x) #'("quote" ()))
|
3183
|
+
((null? (cdr x)) (car x))
|
3184
|
+
(else (with-syntax (((p ...) x)) #'("append" p ...)))))
|
3185
|
+
(_
|
3186
|
+
(cond
|
3187
|
+
((null? x) y)
|
3188
|
+
(else (with-syntax (((p ...) x) (y y)) #'("append" p ... y)))))))
|
3189
|
+
(define (quasilist* x y)
|
3190
|
+
(let f ((x x))
|
3191
|
+
(if (null? x)
|
3192
|
+
y
|
3193
|
+
(quasicons (car x) (f (cdr x))))))
|
3194
|
+
(define (quasivector x)
|
3195
|
+
(syntax-case x ()
|
3196
|
+
(("quote" (x ...)) #'("quote" #(x ...)))
|
3197
|
+
(_
|
3198
|
+
(let f ((y x) (k (lambda (ls) #`("vector" #,@ls))))
|
3199
|
+
(syntax-case y ()
|
3200
|
+
(("quote" (y ...)) (k #'(("quote" y) ...)))
|
3201
|
+
(("list" y ...) (k #'(y ...)))
|
3202
|
+
(("list*" y ... z) (f #'z (lambda (ls) (k (append #'(y ...) ls)))))
|
3203
|
+
(else #`("list->vector" #,x)))))))
|
3204
|
+
(define (emit x)
|
3205
|
+
(syntax-case x ()
|
3206
|
+
(("quote" x) #''x)
|
3207
|
+
(("list" x ...) #`(list #,@(map emit #'(x ...))))
|
3208
|
+
;; could emit list* for 3+ arguments if implementation supports
|
3209
|
+
;; list*
|
3210
|
+
(("list*" x ... y)
|
3211
|
+
(let f ((x* #'(x ...)))
|
3212
|
+
(if (null? x*)
|
3213
|
+
(emit #'y)
|
3214
|
+
#`(cons #,(emit (car x*)) #,(f (cdr x*))))))
|
3215
|
+
(("append" x ...) #`(append #,@(map emit #'(x ...))))
|
3216
|
+
(("vector" x ...) #`(vector #,@(map emit #'(x ...))))
|
3217
|
+
(("list->vector" x) #`(list->vector #,(emit #'x)))
|
3218
|
+
(("value" x) #'x)))
|
3219
|
+
(lambda (x)
|
3220
|
+
(syntax-case x ()
|
3221
|
+
;; convert to intermediate language, combining introduced (but
|
3222
|
+
;; not unquoted source) quote expressions where possible and
|
3223
|
+
;; choosing optimal construction code otherwise, then emit
|
3224
|
+
;; Scheme code corresponding to the intermediate language forms.
|
3225
|
+
((_ e) (emit (quasi #'e 0)))))))
|
3226
|
+
|
3227
|
+
(define-syntax include
|
3228
|
+
(lambda (x)
|
3229
|
+
(define read-file
|
3230
|
+
(lambda (fn dir k)
|
3231
|
+
(let* ((p (open-input-file
|
3232
|
+
(cond ((absolute-file-name? fn)
|
3233
|
+
fn)
|
3234
|
+
(dir
|
3235
|
+
(in-vicinity dir fn))
|
3236
|
+
(else
|
3237
|
+
(syntax-violation
|
3238
|
+
'include
|
3239
|
+
"relative file name only allowed when the include form is in a file"
|
3240
|
+
x)))))
|
3241
|
+
(enc (file-encoding p)))
|
3242
|
+
|
3243
|
+
;; Choose the input encoding deterministically.
|
3244
|
+
(set-port-encoding! p (or enc "UTF-8"))
|
3245
|
+
|
3246
|
+
(let f ((x (read p))
|
3247
|
+
(result '()))
|
3248
|
+
(if (eof-object? x)
|
3249
|
+
(begin
|
3250
|
+
(close-port p)
|
3251
|
+
(reverse result))
|
3252
|
+
(f (read p)
|
3253
|
+
(cons (datum->syntax k x) result)))))))
|
3254
|
+
(let* ((src (syntax-source x))
|
3255
|
+
(file (and src (assq-ref src 'filename)))
|
3256
|
+
(dir (and (string? file) (dirname file))))
|
3257
|
+
(syntax-case x ()
|
3258
|
+
((k filename)
|
3259
|
+
(let ((fn (syntax->datum #'filename)))
|
3260
|
+
(with-syntax (((exp ...) (read-file fn dir #'filename)))
|
3261
|
+
#'(begin exp ...))))))))
|
3262
|
+
|
3263
|
+
(define-syntax include-from-path
|
3264
|
+
(lambda (x)
|
3265
|
+
(syntax-case x ()
|
3266
|
+
((k filename)
|
3267
|
+
(let ((fn (syntax->datum #'filename)))
|
3268
|
+
(with-syntax ((fn (datum->syntax
|
3269
|
+
#'filename
|
3270
|
+
(canonicalize-path
|
3271
|
+
(or (%search-load-path fn)
|
3272
|
+
(syntax-violation 'include-from-path
|
3273
|
+
"file not found in path"
|
3274
|
+
x #'filename))))))
|
3275
|
+
#'(include fn)))))))
|
3276
|
+
|
3277
|
+
(define-syntax unquote
|
3278
|
+
(lambda (x)
|
3279
|
+
(syntax-violation 'unquote
|
3280
|
+
"expression not valid outside of quasiquote"
|
3281
|
+
x)))
|
3282
|
+
|
3283
|
+
(define-syntax unquote-splicing
|
3284
|
+
(lambda (x)
|
3285
|
+
(syntax-violation 'unquote-splicing
|
3286
|
+
"expression not valid outside of quasiquote"
|
3287
|
+
x)))
|
3288
|
+
|
3289
|
+
(define (make-variable-transformer proc)
|
3290
|
+
(if (procedure? proc)
|
3291
|
+
(let ((trans (lambda (x)
|
3292
|
+
#((macro-type . variable-transformer))
|
3293
|
+
(proc x))))
|
3294
|
+
(set-procedure-property! trans 'variable-transformer #t)
|
3295
|
+
trans)
|
3296
|
+
(error "variable transformer not a procedure" proc)))
|
3297
|
+
|
3298
|
+
(define-syntax identifier-syntax
|
3299
|
+
(lambda (xx)
|
3300
|
+
(syntax-case xx (set!)
|
3301
|
+
((_ e)
|
3302
|
+
#'(lambda (x)
|
3303
|
+
#((macro-type . identifier-syntax))
|
3304
|
+
(syntax-case x ()
|
3305
|
+
(id
|
3306
|
+
(identifier? #'id)
|
3307
|
+
#'e)
|
3308
|
+
((_ x (... ...))
|
3309
|
+
#'(e x (... ...))))))
|
3310
|
+
((_ (id exp1) ((set! var val) exp2))
|
3311
|
+
(and (identifier? #'id) (identifier? #'var))
|
3312
|
+
#'(make-variable-transformer
|
3313
|
+
(lambda (x)
|
3314
|
+
#((macro-type . variable-transformer))
|
3315
|
+
(syntax-case x (set!)
|
3316
|
+
((set! var val) #'exp2)
|
3317
|
+
((id x (... ...)) #'(exp1 x (... ...)))
|
3318
|
+
(id (identifier? #'id) #'exp1))))))))
|
3319
|
+
|
3320
|
+
(define-syntax define*
|
3321
|
+
(lambda (x)
|
3322
|
+
(syntax-case x ()
|
3323
|
+
((_ (id . args) b0 b1 ...)
|
3324
|
+
#'(define id (lambda* args b0 b1 ...)))
|
3325
|
+
((_ id val) (identifier? #'id)
|
3326
|
+
#'(define id val)))))
|