Before, the optional args in a lambda-case could be #f or a list of
symbols. However the list of symbols is entirely sufficient; no
optional args means a null list. Change everywhere that produces
lambda-case, matches on lambda-case, and reads deserialized lambda-case.
Instead of defining a separate module, given that "read" calls are quite
all over the place, we're just going to replace the boot "read" binding
with read.scm. This way, we'll be able to remove support for reader
options in the boot reader, as it will only ever be used for a finite
set of files.
* NEWS: Update.
* module/Makefile.am (ice-9/boot-9.go): Depend on read.scm.
(SOURCES):
* am/bootstrap.am (SOURCES): Don't build a ice-9/read.go, as we include
it.
* module/ice-9/boot-9.scm (read-syntax): Define here, as "include" now
uses it.
(read-hash-procedures, read-hash-procedure, read-hash-extend): New
procedures. Will replace C variants.
(read, read-syntax): Include read.scm to define these.
* module/ice-9/psyntax-pp.scm (include): Regenerate.
* module/ice-9/psyntax.scm (include): Use read-syntax, so we get better
source information.
* module/ice-9/read.scm (let*-values): New local definition, to avoid
loading srfi-11.
(%read): Use list->typed-array instead of u8-list->bytevector.
* module/language/scheme/spec.scm: Remove (ice-9 read) import;
read-syntax is there in the boot environment
* module/language/scheme/decompile-tree-il.scm (choose-output-names):
A <lambda> with no <lambda-case> decompiles into a 'case-lambda'
primitive. Ensure that 'case-lambda' is not shadowed by a lexical.
* module/language/tree-il.scm (<prompt>): Change to have the body and
handler be lambdas, and add an "escape-only?" field. This will make
generic prompts work better in CPS or ANF with the RTL VM, as it
doesn't make sense in that context to capture only part of a frame.
Escape-only prompts can still be fully inlined.
(parse-tree-il, unparse-tree-il): Add escape-only? to the
serialization.
(make-tree-il-folder, pre-post-order): Deal with escape-only?.
* module/language/tree-il/analyze.scm (analyze-lexicals): Handle
escape-only?, and the new expectations for the body and handler.
* module/language/tree-il/canonicalize.scm (canonicalize): Ensure that
the body of an escape-only continuation is a thunk, and that the
handler is always a lambda.
* module/language/tree-il/debug.scm (verify-tree-il): Assert that
escape-only? is a boolean.
* module/language/tree-il/cse.scm (cse):
* module/language/tree-il/effects.scm (make-effects-analyzer):
* module/language/tree-il/peval.scm (peval):
* module/language/tree-il/primitives.scm (*primitive-expand-table*):
* test-suite/tests/peval.test ("partial evaluation"):
* module/language/tree-il/compile-glil.scm (flatten-lambda-case): Adapt
to <prompt> change.
* libguile/vm-i-system.c (push-fluid, pop-fluid):
* doc/ref/vm.texi (Dynamic Environment Instructions): Rename wind-fluids
to push-fluid, and unwind-fluids to pop-fluid. They now only work on
one fluid binding at a time.
* module/ice-9/boot-9.scm (with-fluid*): Implement in Scheme in terms of
primcalls to push-fluid and pop-fluid.
(custom-throw-handler, catch, with-throw-handler): Use with-fluid*
instead of with-fluids, as with-fluids is no longer available before
psyntax is loaded.
(with-fluids): Define in Scheme in terms of with-fluid*.
* libguile/fluids.c (scm_with_fluid): Rename from scm_with_fluids, and
don't expose to Scheme.
* libguile/eval.c (eval): Remove SCM_M_WITH_FLUIDS case.
* libguile/expand.c (expand_with_fluids): Remove with-fluids syntax.
(DYNLET): Remove, no longer defining dynlet in the %expanded-vtables.
* libguile/expand.h: Remove dynlet definitions.
* module/ice-9/eval.scm (primitive-eval): Remove with-fluids case.
* libguile/memoize.c (do_push_fluid, do_pop_fluid): New primitive
helpers, like wind and unwind.
(memoize): Memoize wind and unwind primcalls. Don't memoize dynlet to
with-fluids.
(scm_init_memoize): Initialize push_fluid and pop_fluid here.
* libguile/memoize.h (SCM_M_WITH_FLUIDS): Remove definition.
* module/ice-9/psyntax.scm (build-dynlet): Remove; this just supported
with-fluids, which is now defined in boot-9.
* module/ice-9/psyntax-pp.scm: Regenerate.
* doc/ref/compiler.texi (Tree-IL):
* module/language/tree-il.scm:
* module/language/tree-il/analyze.scm:
* module/language/tree-il/canonicalize.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/cse.scm:
* module/language/tree-il/debug.scm:
* module/language/tree-il/effects.scm: Remove <dynlet>. Add cases for
primcalls to push-fluid and pop-fluid in compile-glil.scm and
effects.scm.
* module/language/tree-il/peval.scm (peval): Factor out
with-temporaries; probably a bad idea, but works for now. Factor out
make-begin0 (a better idea). Inline primcalls to with-fluid*, and
remove dynlet cases.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
Add with-fluid*.
* doc/ref/compiler.texi: Remove mention of <dynwind>.
* libguile/eval.c (eval): Remove SCM_M_DYNWIND case.
* libguile/expand.c: Remove scm_sym_at_dynamic_wind.
* libguile/memoize.c (do_wind, do_unwind): A couple of hacky subrs. If
we see a wind or unwind primcall, we expand to a call of a quoted subr
value. It works and removes a kind of memoized value from the
interpreter. For the compiler,primcalls to wind and unwind are
handled specially.
(MAKMEMO_DYNWIND): Remove.
(scm_tc16_memoizer): Remove. Yay!
(memoize): Remove speculative lookup for toplevels to see if they are
memoizers: there are no more memoizers. Memoize calls to the wind and
unwind primitives.
(m_dynamic_wind): Remove.
(unmemoize): Remove dynwind case.
(scm_init_memoize): Add wind and unwind local definitions.
* module/ice-9/boot-9.scm (dynamic-wind): Reimplement in terms of "wind"
and "unwind" primitives. These primitives are not exposed to other
modules.
* module/ice-9/eval.scm (primitive-eval): Remove dynwind case.
* module/language/scheme/decompile-tree-il.scm (do-decompile):
(choose-output-names): Remove dynwind cases.
* module/language/tree-il.scm: Remove <dynwind>. Yaaay!
* module/language/tree-il/analyze.scm (analyze-lexicals): Remove dynwind
cases.
* module/language/tree-il/compile-glil.scm (*primcall-ops*): Add wind
and unwind.
(flatten-lambda-case): Remove dynwind case. Yay!
* module/language/tree-il/cse.scm (cse):
* module/language/tree-il/debug.scm (verify-tree-il):
* module/language/tree-il/effects.scm (make-effects-analyzer):
* module/language/tree-il/peval.scm (singly-valued-expression?, peval):
Remove <dywind> cases. Inline primcalls to dynamic-wind. Add
constant folding for thunk?.
* module/language/tree-il/primitives.scm (*interesting-primitive-names*):
Remove @dynamic-wind, and add procedure? and thunk?.
(*effect+exception-free-primitives*): Add procedure? and thunk?.
(*multiply-valued-primitives*): Remove @dynamic-wind.
Remove @dynamic-wind expander.
* test-suite/tests/peval.test ("partial evaluation"): Update tests for
dynwind desugaring.
* module/language/tree-il.scm (tree-il->scheme): New implementation that
simply calls 'decompile-tree-il'.
* module/language/scheme/decompile-tree-il.scm (choose-output-names,
do-decompile): New internal procedures.
(decompile-tree-il): New and improved implementation. Print source
identifiers where possible, otherwise add minimal numeric suffixes.
Previously we printed the gensyms. Avoid 'begin' in contexts that
provide an implicit 'begin'. Produce 'cond', 'case', 'and', 'or',
'let*', named let, and internal defines where appropriate. Recognize
keyword arguments in 'opts' to disable the production of these derived
syntactic forms, and to optionally strip numeric suffixes from
variable names.
* module/ice-9/compile-psyntax.scm: Disable partial evaluation, letrec
fixing, and primitive expansion when producing psyntax-pp.scm, in
order to produce output as close to the original source as practical.
Disable production of derived syntactic forms as needed during
bootstrap. Strip numeric suffixes from variable names. Adjust
pretty-printing parameters.
* module/ice-9/psyntax-pp.scm: Regenerate. It is now less than half
of the original size.
* module/language/tree-il/analyze.scm
(format-analysis)[check-simple-format-args]: New procedure. Use it.
Add support for applications of <module-ref>.
* module/system/base/message.scm (%warning-types): Handle the `format
simple-format' warning.
* module/language/scheme/spec.scm (scheme)[make-default-environment]:
Use `simple-format' as the default `format'.
* test-suite/tests/tree-il.test ("warnings")["format"]: Explicitly use
(@ (ice-9 format) format) where needed.
("simple-format"): New test prefix.
* libguile/read.c (scm_read_opts): Default "positions" to #t. The
compiler was already turning it on anyway, and this allows
primitive-load without --auto-compile to also propagate source
information through the expander, for better errors and to let macros
know their source.
* module/language/scheme/spec.scm: No need to enable positions here
now.
* module/system/base/language.scm (<language>): Remove the `version'
field from languages. It just wasn't useful.
* module/language/assembly/spec.scm:
* module/language/brainfuck/spec.scm:
* module/language/bytecode/spec.scm:
* module/language/ecmascript/spec.scm:
* module/language/elisp/spec.scm:
* module/language/glil/spec.scm:
* module/language/objcode/spec.scm:
* module/language/scheme/spec.scm:
* module/language/tree-il/spec.scm:
* module/language/value/spec.scm: Remove #:version from all language
definitions. Shorten some language names (e.g. "Guile Scheme" ->
"Scheme").
* module/ice-9/boot-9.scm (macroexpand): Rename from sc-expand.
(%pre-modules-transformer): Adapt to name change.
* module/ice-9/compile-psyntax.scm: Adapt to name change.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/psyntax.scm: Rename sc-expand to macroexpand.
* module/language/scheme/compile-tree-il.scm (compile-tree-il): Adapt to
name change.
* module/ice-9/boot-9.scm (make-fresh-user-module): New public function,
makes an anonymous beautified module.
* module/language/objcode/spec.scm: We used to have some things in here
that allowed lexical variable names and values to be a part of the
environment, but no more. Now an environment is just a module. If you
want to "inject" free variables into code, just use lambda.
* module/language/scheme/compile-tree-il.scm (compile-tree-il): Same
here. Also, rely on the fact that an environment *will* be a module --
because (system base compile) guarantees that for us.
* module/language/scheme/spec.scm (scheme): In the reader, rely on the
environment being a module. Define a #:make-default-environment
handler, which returns a beautified module, augmented with a fresh
definition for current-reader, so that side effects to current-reader
are restricted to the compilation unit.
* module/language/tree-il/analyze.scm
(report-possibly-unbound-variables):
* module/language/tree-il/compile-glil.scm (compile-glil):
* module/language/tree-il/optimize.scm (optimize!): The environment will
be a module.
* module/system/base/language.scm (<language>): New field,
`make-default-environment'. Defaults to `make-fresh-user-module'.
(default-environment): New accessor, returns a default environment for
a language.
* module/system/repl/common.scm (repl-compile): Always compile relative
to the current module, because a module is always acceptable as an
environment.
* module/system/base/compile.scm (compile-file, compile-and-load): Both
of these have a new keyword argument, #:env. For `compile-file', it
defaults to the default environment of the source language, and for
`compile-and-load', to the current module.
(read-and-compile): If there are no expressions read, pass the joiner
its default environment (via `default-environment joint').
* module/language/assembly/spec.scm:
* module/language/brainfuck/spec.scm:
* module/language/bytecode/spec.scm:
* module/language/ecmascript/spec.scm:
* module/language/glil/spec.scm:
* module/language/scheme/spec.scm:
* module/language/tree-il/spec.scm: Language-readers now take two
arguments: the port and the environment. This should allow for
compile-environment-specific reader behavior.
* module/system/base/compile.scm (read-and-compile):
* module/system/repl/common.scm (repl-read): Pass the environment to the
language-reader.
* module/system/repl/repl.scm (meta-reader, prompting-meta-read):
* module/system/repl/command.scm (define-meta-command): Use the second
argument to repl-reader, so we avoid frobbing current-reader.
GHIL is obsolete, and it's about time we got rid of it. Elisp and R5RS
were unmodified since their import from Guile-VM, so we ditch them too.
R5RS compilation is supported via compiling Scheme within an R5RS
environment.
Elisp will be supported when we merge in Daniel's work.
* module/language/scheme/spec.scm (scheme)[#:reader]: Honor the
compilation environment's `current-reader'.
* module/system/base/compile.scm (*compilation-environment*): New
fluid.
(current-compilation-environment): New procedure.
(make-compilation-module): Provide a fresh `current-reader' fluid.
(read-and-compile): Set `*compilation-environment*' appropriately.
(compile): Likewise.
* test-suite/tests/compiler.test (read-and-compile): New.
("current-reader"): New test prefix.
* module/Makefile.am (SOURCES): Reorganize so GHIL is compiled last,
along with ecmascript.
* module/language/scheme/spec.scm: Remove references to GHIL, as it's
bitrotten and obsolete..
* module/language/tree-il.scm (make-tree-il-folder): Rework so that we
only have down and up procs, and call down and up on each element.
* module/language/tree-il/analyze.scm (analyze-lexicals): Fix a thinko
handling let-values.
* module/language/tree-il/fix-letrec.scm: Actually implement fixing
letrec. The resulting code will perform better, but violations of the
letrec restriction are not detected. This behavior is allowed by the
spec, but it is undesirable. Perhaps that will be fixed later.
* module/language/tree-il/inline.scm (inline!): Fix a case in which
((lambda args foo)) would be erroneously inlined to foo. Remove empty
let, letrec, and fix statements.
* module/language/tree-il/primitives.scm (effect-free-primitive?): New
public predicate.
* doc/ref/api-procedures.texi (Compiled Procedures): Fix for API changes.
* doc/ref/compiler.texi (Compiling to the Virtual Machine): Replace GHIL
docs with Tree-IL docs. Update the bits about the Scheme compiler to
talk about Tree-IL and the expander instead of GHIL. Remove
<glil-argument>. Add placeholder sections for assembly and bytecode.
* doc/ref/vm.texi: Update examples with what currently happens. Reword
some things. Fix a couple errors.
* libguile/vm-i-system.c (externals): Remove this instruction, it's not
used.
* module/ice-9/documentation.scm (object-documentation): If the object is
a macro, try to return documentation on the macro transformer.
* module/language/assembly/disassemble.scm (disassemble-load-program):
Fix problem in which we skipped the first element of the object vector,
because of changes to procedure layouts a few months ago.
* module/language/scheme/spec.scm (read-file): Remove read-file
definition.
* module/language/tree-il.scm: Reorder exports. Remove <lexical>, it was
a compat shim to something that was never released. Fix `location'.
* module/language/tree-il/primitives.scm (/): Fix expander for more than
two args to /.
* module/system/base/compile.scm (read-file-in): Remove unused
definition.
* module/system/base/language.scm (system): Remove language-read-file.
* module/language/ecmascript/spec.scm (ecmascript): Remove read-file
definition.
* module/ice-9/boot-9.scm (guile-user): Move the `compile' autoload to
the guile-user module. Remove reference to compile-time-environment.
* module/language/scheme/compile-ghil.scm:
* module/language/tree-il/compile-glil.scm:
* module/language/tree-il/optimize.scm:
* module/system/base/compile.scm:
* test-suite/tests/compiler.test: Remove definition of and references to
compile-time-environment. While I do think that recompilation based on
a lexical environment can be useful, I think it needs to be implemented
differently. So for now we've lost nothing if we take it away, as it
doesn't work with syncase anyway.
* module/ice-9/psyntax.scm (chi-install-global, syntax-case): Fix a
couple of cases in which bare datums were passed to output
constructors.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/scheme/spec.scm (scheme): Clean up the #:compilers
list.
* module/language/tree-il/compile-glil.scm (flatten): Fix call to
`length' in call/cc compiler.
* libguile/vm-i-system.c:
* libguile/vm-engine.h (ASSERT_BOUND): New assertion, that a value is
bound. Used by local-ref and external-ref in paranoid mode.
* module/ice-9/boot-9.scm (and, or, cond, case, do): Since we are
switching to use psyntax as the first pass of the compiler, and perhaps
soon of the interpreter too, we need to make sure it expands out all
forms to primitive expressions. So define expanders for these derived
syntax forms, as in the R5RS report.
* module/ice-9/psyntax-pp.scm: Regenerate, with core forms fully
expanded.
* module/ice-9/psyntax.scm (build-void): New constructor, for making
undefined values.
(build-primref): Add in a hack so that primitive refs in the boot
module expand out to toplevel refs, not module refs.
(chi-void): Use build-void.
(if): Define an expander for if that calls build-conditional.
* module/language/scheme/compile-tree-il.scm (compile-tree-il): Use let*
so as not to depend on binding order for the result of
(current-module).
* module/language/scheme/spec.scm (scheme): Switch over to tree-il as the
primary intermediate language. Not yet fully tested, but at least it
can compile psyntax-pp.scm.
* module/language/tree-il/analyze.scm (analyze-lexicals): Arguments don't
count towards a function's nlocs.
* module/language/tree-il/compile-glil.scm (*comp-module*, compile-glil):
Define a "compilation module" fluid.
(flatten-lambda): Fix a call to make-glil-argument. Fix bug in
heapifying arguments.
(flatten): Fix number of arguments passed to apply instruction. Add a
special case for `(values ...)'. If inlining primitive-refs fails,
try expanding into toplevel-refs if the comp-module's variable is the
same as the root variable.
* module/language/tree-il/optimize.scm (resolve-primitives!): Add missing
src variable for <module-ref>.
* test-suite/tests/tree-il.test ("lambda"): Fix nlocs counts. Add a
closure test case.
* module/language/scheme/amatch.scm: Remove, this approach won't be used.
* module/Makefile.am: Adjust for additions and removals.
* module/language/scheme/compile-ghil.scm: Remove an vestigial debugging
statement.
* module/language/scheme/spec.scm:
* module/language/scheme/compile-tree-il.scm:
* module/language/scheme/decompile-tree-il.scm: Add tree-il compiler and
decompiler.
* module/language/tree-il/compile-glil.scm: Add some notes.
* module/language/tree-il/spec.scm: No need to wrap expressions in
lambdas -- GHIL needs somewhere to put its variables, we don't.
* module/Makefile.am: Add tree-il sources.
* module/ice-9/compile-psyntax.scm: Adjust for sc-expand producing
tree-il in compile mode.
* module/ice-9/psyntax.scm: Switch from expand-support to tree-il for
generating output in compile mode. Completely generate tree-il -- the
output wasn't Scheme before, but now it's completely not Scheme.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/scheme/compile-ghil.scm: Strip structures using
tree-il, not expand-support.
* module/language/tree-il.scm:
* module/language/tree-il/spec.scm
* module/language/tree-il/compile-glil.scm: New language. It will compile
to GLIL, though it doesn't yet.
* module/ice-9/psyntax.scm (*mode*): New moving part, a fluid.
(sc-expand): Dynamically bind *mode* to the expansion mode.
(build-global-reference): Change to be a procedure instead of local
syntax. Import the logic about when to make a @ or @@ form to here,
from boot-9.scm. If we are compiling, build output using (ice-9
expand-support)'s make-module-ref, otherwise just making the familiar
s-expressions. (This will allow us to correctly expand in modules in
which @ or @@ are not bound, at least when we are compiling.)
(build-global-assignment): Use the result of build-global-reference. A
bit hacky, but hey.
(top-level-eval-hook, local-eval-hook): Strip expansion structures
before evalling.
* module/ice-9/boot-9.scm (make-module-ref): Remove, this logic is now
back in psyntax.scm.
* module/ice-9/compile-psyntax.scm (source): Since we expand in compile
mode, we need to strip expansion structures.
* module/ice-9/expand-support.scm (strip-expansion-structures): Remove
the logic about whether and how to strip @/@@ from here, as it's part
of psyntax now.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/scheme/compile-ghil.scm (compile-ghil): Strip expansion
structures -- for now. In the future, we might translate directly from
these structures into GHIL.
* module/ice-9/boot-9.scm (sc-expand3):
* module/ice-9/psyntax.scm (sc-expand3): Replace sc-expand with
sc-expand3, as expand3 with one argument is the same as sc-expand.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/compile-psyntax.scm:
* module/language/scheme/compile-ghil.scm: Change callers to sc-expand3
to use sc-expand.
* module/Makefile.am (SCHEME_LANG_SOURCES):
* module/language/scheme/expand.scm: Remove expand.scm, we don't need it
any more.
* module/ice-9/psyntax.scm (build-lambda, chi-lambda-clause): Support
docstrings with internal definitions. What are Scheme people thinking
these days?
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/boot-9.scm
(make-module-ref): equal?, not eq?, when matching on module name.
(Module names don't have to come from an invocation of module-name in
this process.)
* module/ice-9/psyntax.scm (build-global-reference)
(build-global-assignment, @): Rework the format of the module in syntax
objects so that a car of #f indicates a public reference. Loading (foo
%module-public-interface) didn't guarantee that (foo) was loaded and
useful.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/scheme/compile-ghil.scm (lookup-transformer):
primitive-macro? does not exist any more.
* module/ice-9/boot-9.scm: Remove lots of debugging prints. Remove some
already-deprecated attempts to load modules from shared libraries.
* module/ice-9/psyntax.scm: If we have to create a variable for a
syntactic binding, initialize its contents to a gensym. I'd like
something more meaningful, but at least this way we can tell different
macros apart. Only warn about missing modules if modules are booted.
Chi the value part of a (set! (@ ...) ) expression -- whoops!
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/language/glil.scm (parse-glil): Fix an unquoting error.
* module/language/scheme/compile-ghil.scm: No need to import syncase, we
gots it. Rework compiler to expand only once, with syncase, instead of
incrementally. Fix define-scheme-transformer to work with syncase, by
not referencing bare keywords. It works!
* module/language/scheme/expand.scm (re-annotate, expand): A couple of
speculative cases for dealing with syncase better -- but all of this
code is likely to go.
* module/ice-9/compile-psyntax.scm: No more expansion-eval-closure.
* module/ice-9/expand-support.scm (strip-expansion-structures): Only @@
names whose module is not the current module. Actually @@ serialization
is disabled for this commit, just to get this one in and keep things
working.
* module/ice-9/psyntax-pp.scm: Recompiled.
* module/ice-9/psyntax.scm (put-global-definition-hook)
(get-global-definition-hook): Instead of going through that stupid
getprop/putprop interface, let's just inline Guile-specific code here.
(build-global-reference, build-global-assignment): Fix a bug where the
module and public? were switched, which happily allowed things to
compile. (We reintroduce a similar bug above in expand-support.)
(lookup): Add a module argument.
(global-extend): Adapt for put-global-definition-hook invocation.
(syntax-type): Lookup with mod. Return mod even for lexicals and
define-form -- why not.
(chi-top, fluid-let-syntax, syntax, set!): Lookup with mod. Wrap with
mod.
* module/ice-9/syncase.scm (expansion-eval-closure)
(current-eval-closure, env->eval-closure): OK! So the idea is: module
hygiene is syncase's business, not ours. So lose the eval-closure
fluid. Also, eval closures are so 1990s.
(sc-macro): But, we have to take the module from the env, sadly. In the
future this will be different.
Remove the rest of the eval-closure bits. Enable source reporting,
while we're debugging.
* module/language/scheme/compile-ghil.scm (lookup-transformer): Adapt for
eval closure fluid changes.
* module/ice-9/Makefile.am: Replace annotate.scm with expand-support.scm.
* module/ice-9/annotate.scm: Removed; subsumed into expand-support.scm.
* module/ice-9/compile-psyntax.scm: Strip out expansion structures before
writing to disk.
* module/ice-9/expand-support.scm: New file. Provides annotation support,
and other compound data types for use by the expander. Currently the
only one that is used is the toplevel reference, <module-ref>, but we
will record lexicals this way soon.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (build-global-reference)
(build-global-assignment): Instead of expanding out global references
as symbols, expand them as <module-ref> structures, with space to
record the module that they should be scoped against. This is in
anticipation of us actually threading the module info through the
syntax transformation, so that we can get hygiene with respect to
modules.
* module/ice-9/syncase.scm: Replace eval-when. Since sc-expand will give
us something that isn't Scheme because we put the <module-ref>
structures in it, strip that info whenever we actually do need scheme.
* module/language/scheme/compile-ghil.scm (lookup-transformer): Strip
expansion structures here too.
* module/language/scheme/expand.scm (language): Swap annotate for
expand-support. But this file will die soon, I think.
* module/language/ghil.scm (unparse-ghil): Fix unparsing of quasiquoted
expressions.
* module/language/ghil/spec.scm (join): Define a joiner for GHIL.
* module/language/scheme/compile-ghil.scm (cenv-ghil-env): Expand the
definition of a CENV so it can have an actual ghil-env, if available.
(compile-ghil): Return the actual ghil env in the cenv.
* module/system/base/compile.scm (compile-file): Rewrite. `output-file'
is now a keyword argument, along with the new kwargs `env' and `from'.
We now allow exceptions to propagate up, and instead of printing the
output file to the console, we return a string corresponding to its
location.
(compile-and-load): Use read-and-compile.
(compile-fold): Thread around the cenv as well. Return all three
values.
(find-language-joint, read-and-compile): New exciting helpers. The idea
is that compiling a file should be semantically equivalent to compiling
each expression in it, one by one. Compilation can have side effects,
e.g. affecting the current language or the current reader. So what we
do is find a point in the compilation path at which different
expressions of a given language can be joined into one. Expressions
from the source language are compiled to the joint language, then
joined and compiled to the target.
(compile): Just return the first value from compile-fold.
* module/system/base/language.scm (language-joiner): New optional field.
* scripts/compile: Rework for changes to compile-file.
* module/system/base/compile.scm: Expect compile passes to produce three
values, not two. The third is the "continuation environment", the
environment that can be used to compile a subsequent expression from
the same source language. For example, expansion-time side effects can
set the current module, which would be reflected appropriately in the
continuation environment.
* module/language/assembly/compile-bytecode.scm:
* module/language/bytecode/spec.scm:
* module/language/ecmascript/compile-ghil.scm:
* module/language/ghil/compile-glil.scm:
* module/language/glil/spec.scm:
* module/language/objcode/spec.scm:
* module/language/scheme/compile-ghil.scm:
* module/system/base/compile.scm: Update compile passes to return a
continuation environment.
* module/ice-9/annotate.scm (<annotation>): Slightly more concise
printing.
(annotate): Don't create annotations if we have no source info.
* module/ice-9/psyntax.scm (annotation?): Remove this definition, as we
now provide annotation support.
* module/ice-9/psyntax-pp.scm: Regenerated.
* module/ice-9/syncase.scm: Use (ice-9 annotate).
* module/language/scheme/expand.scm (eval-when): Define the eval-when
transformer.
* module/ice-9/boot-9.scm (eval-when): Replace eval-case with eval-when.
Eval-when is *much* simpler, and more expressive to boot. Perhaps in
the future we'll get 'visit and 'revisit too.
* module/ice-9/deprecated.scm (eval-case): Provide mostly-working
deprecated version of eval-case.
* module/ice-9/boot-9.scm (defmacro, define-macro): Relax condition: we
can make defmacros that are not at the toplevel now. But in the future
we should replace this implementation of defmacros with one written in
syntax-case.
(define-module, use-modules, use-syntax): Allow at non-toplevel.
(define-public, defmacro-public, export, re-export): Don't evaluate at
compile-time, I can't see how that helps things. Allow `export' and
`re-export' at non-toplevel.
* module/ice-9/getopt-long.scm:
* module/ice-9/i18n.scm:
* module/oop/goops.scm:
* module/oop/goops/compile.scm:
* module/oop/goops/dispatch.scm: Switch to use eval-when, not
eval-case.
* module/language/scheme/compile-ghil.scm (eval-when): Replace eval-case
transformer with eval-when transformer. Sooooo much simpler, and it
will get better once we separate expansion from compilation.
* module/language/scheme/expand.scm (quasiquote): Hm, expand quasiquote
properly. Not hygienic. Syncase needed.
(lambda): Handle internal defines with docstrings propertly.
* module/language/scheme/expand.scm: New module, implements a separate
expansion phase, not interleaved with compilation.
* module/language/scheme/amatch.scm: Helper for expand.scm, it's pmatch
with support for annotated source.
* module/ice-9/Makefile.am (SOURCES): Add annotate.scm to build list --
early on because it will be used in the compiler.
* module/ice-9/annotate.scm: Fix the printer, default to unstripped
(whatever that is), and add a deannotator.
* module/system/base/compile.scm (call-with-compile-error-catch): Fix for
new representation of source locations.
* module/Makefile.am (SCHEME_LANG_SOURCES): Add amatch and expand.
* am/guilec (.scm.go): Create the target's directory, in case
$(builddir) != $(srcdir).
* configure.in: Don't output any makefile under `module/system' or
`module/language'.
* module/Makefile.am (SUBDIRS): Remove `language' and `system'. Add `.'
to the front.
(modpath, SOURCES, SCHEME_LANG_SOURCES, ECMASCRIPT_LANG_SOURCES,
GHIL_LANG_SOURCES, GLIL_LANG_SOURCES, ASSEMBLY_LANG_SOURCES,
BYTECODE_LANG_SOURCES, OBJCODE_LANG_SOURCES, VALUE_LANG_SOURCES): New
variables, taken from former `Makefile.am' files in sub-directories.