* 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/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/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/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/ghil/compile-glil.scm (codegen): If there are more than
255 arguments, make a list and use apply instead of calling directly.
* module/language/Makefile.am: Now we can compile parse.scm. Yay!
* module/language/scheme/compile-ghil.scm: Add a note.
* module/language/ecmascript/compile-ghil.scm: Add a note.
* module/language/Makefile.am: OK, we can compile compile-ghil.scm now,
thankfully.
* module/language/ecmascript/compile-ghil.scm (ormatch): New macro, a
wrapper around pmatch to avoid some of the more egregious
non-tail recursiveness.
(comp): Use ormatch.
* module/language/ghil.scm (unparse-ghil): The body of bind and mv-bind
is a single expression, not a list of expressions.
* module/language/ghil/compile-glil.scm (codegen): Be more clever when
allocating "local" variables -- if a variable goes out of scope, its
index can be re-used later.
* module/language/glil.scm (parse-glil, unparse-ghil): The "rest" of a
mv-bind is a flag, not a list. The "ra" of an mv-call is a label, not a
GLIL expression.
* module/language/objcode/spec.scm (collapse-locals, decompile-value):
When decompiling a value, process the bindings list differently.
Comments in the code.
* module/language/scheme/compile-ghil.scm (define-scheme-translator): Fix
the generated error procedure.
(let): Re-indent.
(letrec): Re-indent.
* module/system/base/syntax.scm (record-case): If the body of a clause is
null, fill it with the unspecified value.
* module/language/scheme/compile-ghil.scm (define-scheme-translator):
Only add an else clause if the transformer didn't have one.
* module/oop/goops.scm (min-fixnum, max-fixnum): Define at compile-time
as well.
(@slot-ref, @slot-set!): Only define transformers for these at
compile-time. Avoids loading up the compiler unnecessarily. Also, allow
for the `n' to be determined lexically, in which case we dispatch to
the primitive.
(num-standard-pre-cache, define-standard-accessor-method)
(bound-check-get, standard-get, standard-set): Rework the fixed-offset
getters and setters so that they can be computed at compile-time.
Accessors to fields with n > num-standard-pre-cache will be dispatched
to the primitive instead of within the VM.
* module/system/base/syntax.scm (define-record): So, in the generated
constructors, allow optional arguments, but not keyword arguments.
Conses much less in the constructors.
(define-record/keywords): And the old define-record is here.
* module/language/ghil.scm (parse-ghil):
* module/language/ghil/compile-glil.scm (codegen):
* module/language/scheme/compile-ghil.scm (translate-1, quote)
(quasiquote): Don't use keywords in this compiler hotpath.
* module/system/base/language.scm (<language>):
* module/system/repl/common.scm (<repl>):
* module/system/vm/debug.scm (<debugger>): Use define-record/keywords.
* module/language/ghil/compile-glil.scm (codegen): Record source location
for offset 0 into a lambda, if we can.
* module/language/scheme/compile-ghil.scm (translate-1)
(define-scheme-translator): In the retrans procedures, propagate the
location information from the enclosing expression if the subexpression
has no location information. Gives source information to many more
expressions.
(location): Just propagate the source properties as they are, the
glil->assembly compiler will interpret them.
* module/language/glil.scm (<glil>): Change glil-source to take "props"
and not "loc", as it's the source properties that we're interested in.
* module/language/glil/compile-assembly.scm (limn-sources): New function,
takes a list of addr-source property pairs and "compresses" them for
serialization to disk.
(glil->assembly): Limn the sources before writing them to disk. Avoid
non-tail recursion when determining total byte length of code.
* module/system/vm/program.scm (source:file, source:line, source:column):
Update for new source representation.
(program-source): Export.
(write-program): Nicer pretty-printing of anonymous procedures.
* libguile/backtrace.c (display_backtrace_get_file_line): Update for the
new VM source representation.
* libguile/programs.h:
* libguile/programs.c (scm_program_sources): Update for the new
serialized source representation, where the filename is not in the
stream unless it changes.
(scm_program_source): New exported function, looks up the source for a
given ip offset.
(scm_c_program_source): Update to return the last source information
that was <= the given IP, because we only serialize source info when it
changes.
* module/language/scheme/compile-ghil.scm (lookup-transformer): Allow
macros to be unquoted into the car of any form that results from macro
expansion. This lets modules export defmacros built on other defmacros
that are not exported.
* libguile/stacks.c (scm_make_stack): Instead of aborting when we misread
the number of stack frames, just print a warning. I'd like to figure
out what these cases are, exactly.
* module/language/scheme/compile-ghil.scm (lambda): Reindent the lambda
transformer.
* module/system/base/compile.scm (call-with-compile-error-catch): Write
the expression instead of displaying it.
(call-with-output-file/atomic): Don't actually redirect output to this
port, as it's not necessary -- the language-printer should respect the
port that we pass.
* doc/ref/api-evaluation.texi: Fix some typos and xrefs.
* doc/ref/compiler.texi (The Scheme Compiler): Document the scheme
compiler, and start documenting the GHIL language.
* doc/ref/guile.texi (Guile Implementation): Whoops, put autoconf after
the implementation foo. Unless we want it before?
* doc/ref/history.texi (The Emacs Thesis): Fix typo.
* doc/ref/vm.texi (Environment Control Instructions): Rename offset to
index.
* module/language/ghil.scm (parse-ghil): Fix what I think was a bug --
the consumer in a mv-call shouldn't be a rest arg.
* module/language/scheme/Makefile.am (SOURCES):
* module/language/scheme/compile-ghil.scm: Rename this file from
translate.scm.
* module/oop/goops.scm:
* module/language/scheme/spec.scm: Deal with renaming.
2009-01-09 17:49:09 +01:00
Renamed from module/language/scheme/translate.scm (Browse further)