* module/system/base/compile.scm: Also import load-objcode from (system
vm core).
* module/language/scheme/translate.scm (lookup-transformer): Use
sc-expand3 in compilation mode when compiling macros. Yay, syncase
macros compile!
* module/system/vm/assemble.scm (dump-object!):
* src/vm_loader.c (VM_DEFINE_LOADER): Use scm_from_locale_keywordn, not
the krazy dash symbol stuff.
* module/language/scheme/translate.scm (lookup-transformer): Add a
special case for syncase macros.
* module/language/scheme/translate.scm (primitive-syntax-table):
Translate the `else' clause of a cond as (begin ...). We used to use
trans-body, which processes internal defines, which are not legal
syntax here.
* module/system/base/syntax.scm (define-record): Unfortunately, we can't
unquote in the actual procedure for `%compute-initargs', because that
doesn't work with compilation. So reference %compute-initargs by name,
and export it.
* module/system/il/ghil.scm (apopq!): Gaaaaar. The order of the arguments
to assq-remove! was reversed, which was the badness, causing corruption
to the env after calling call-with-ghil-bindings. Grrrrrr.
(fix-ghil-mod!, ghil-lookup, ghil-define): As amply commented in the
code, deal with compile-time side effects to the current module by
lazily noticing and patching up the compile-time environment. A hacky
solution until such a time as we special-case something for
`define-module'.
* module/language/scheme/translate.scm (trans):
* module/system/il/compile.scm (codegen): When making records where a
value can be a keyword, make sure to use the keyword initialization
form, so that the record initializer doesn't interpret the keyword as a
slot name.
* module/system/base/Makefile.am (vm_DATA): For now, don't compile
pmatch.
* module/language/scheme/translate.scm (*the-compile-toplevel-symbol*)
(primitive-syntax-table): Existing eval-case invocations in boot-9.scm
only have `load-toplevel', not `load-toplevel' and `compile-toplevel'
as they should. Allow for interpreting `load-toplevel' as
`compile-toplevel'.
* module/language/scheme/translate.scm (trans): Remove the hacky case for
the unspecified value, not needed any more.
(primitive-syntax-table): Rework eval-case to understand
compile-toplevel and evaluate contexts, as in common lisp's eval-when:
http://www.lisp.org/HyperSpec/Body/speope_eval-when.html
This is the Right Thing.
* module/language/scheme/translate.scm (eval-at-compile-time)
(&compile-time-module, expand-macro): Remove this attempt at dealing
with macros. Instead, we're going to rely on macros being first-class,
and just catch eval-case at the bottom.
(lookup-transformer): Lookup all syntax transformers in the module's
eval closure. We catch the primitive-macros, compiling them to ghil,
and expand the rest.
(lookup-transformer): Fold in trans-pair here. Add a hacky case for the
unspecified value; the problem shows up when compiling e.g.
(define-macro (plus! x) `(set! ,x (1+ x))), as a fallout from
eval-case.
(make-pmatch-transformers, primitive-syntax-table): Define the
primitive syntax transformers as a data-driven table instead of a
function. There's a bit of syntax, too. Eval-case was rewritten to use
pmatch.
* module/system/base/compile.scm (scheme): Define as a thunk instead
of a value, so as to allow (language scheme translate) to be imported
in the repl. Still, a hack.
* module/language/scheme/translate.scm (expand-macro, trans-pair): Remove
support for the scheme form, '(void). Replace it by (begin). What was
Keisuke thinking? :)
* Makefile.am:
* module/Makefile.am:
* module/language/scheme/Makefile.am:
* module/system/Makefile.am:
* module/system/base/Makefile.am:
* module/system/il/Makefile.am:
* module/system/repl/Makefile.am:
* module/system/vm/Makefile.am: Cleaned up to be more complete, if not
completely working.
* module/guile/slib.scm:
* module/slib/: Removed the slib import; it's a bit out of place here,
and bitrotten at that.
Before:
> ,c (set! x 3)
0 (make-int8 3) ;; 3
2 (link "x")
5 (variable-set)
> ,c (define x 3)
0 (make-int8 3) ;; 3
2 (link "x")
5 (variable-set)
After:
> ,c (define x 3)
0 (make-int8 3) ;; 3
2 (define "x")
5 (variable-set)
* src/vm_loader.c (link): `link' now errors if the variable is undefined.
This corresponds with desired behavior, for both `ref' and `set'
operations, for scheme. It's not what elisp wants, though. Perhaps
elisp linking needs another instruction.
(define): New instruction, the same as calling scm_define(), basically.
* module/language/scheme/translate.scm (trans-pair): Don't try to look up
an existing variable definition when translating `define'; instead use
the special-purpose lookup from ghil.scm's `ghil-define'.
* module/system/il/compile.scm (codegen): Compile to a different kind of
variable access from `set!', specifically via passing 'define as the op
to `make-glil-var'.
* module/system/il/ghil.scm (ghil-lookup): Don't add to the module table
when compiling variable sets via `set!'.
(ghil-define): New procedure, for looking up variables for `define'.
* module/system/vm/assemble.scm (<vdefine>): New record: a new
instruction type.
(codegen): Compile `define' module vars into <vdefine>.
(dump-object!): <vdefine> == `define'.
* module/language/scheme/translate.scm (trans-pair): Add a guard to only
allow `define' at the top level; other defines are already filtered out
via trans-body.
* module/system/il/ghil.scm (ghil-env-toplevel?): Export, and fix.
* module/language/scheme/translate.scm: Refactor use of `match' to use
`pmatch'. Relatively straightforward.
* module/system/base/pmatch.scm (ppat): Fix some copy-n-paste bugs: the _
rule, the quote rule.
* module/system/base/syntax.scm (define-record): Rework to separate the
type and its constructor. Now (define-record (<foo> bar)) will create
`make-foo' as the constructor, not `<foo>'. Also the constructor now
takes either keyword or positional arguments, so that it can be used as
the implementation of variant types as well.
(|): Map directly to define-record instead of rolling our own thing.
* module/language/scheme/translate.scm:
* module/system/base/language.scm:
* module/system/il/compile.scm:
* module/system/il/ghil.scm:
* module/system/il/glil.scm:
* module/system/repl/common.scm:
* module/system/vm/assemble.scm:
* module/system/vm/debug.scm: Change instances of record creation to use
the make-foo procedures instead of <foo>. Adjust module exports as
necessary.
* module/language/scheme/translate.scm (¤t-macros): Removed.
(¤t-macro-module): Removed.
(&compile-time-module): New.
(eval-at-compile-time): New.
(translate): Initialize `&compile-time-module'.
(expand-macro)[use-syntax]: New case.
[begin let...]: Don't expand these built-in macros.
[else]: Rewrote the macro detection and invocation logic. Invoke macro
transformers in the current compile-time module.
(trans): Let `expand-macro' raise an exception if needed.
(trans-pair)[defmacro define-macro]: Evaluate the macro definition in
the compile-time module.
* testsuite/t-match.scm: Use `use-syntax' instead of `use-modules' for
`(ice-9 match)' and `(srfi srfi-9)'.
* testsuite/t-records.scm: Likewise.
git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-15
* module/language/scheme/translate.scm (trans): Catch exceptions thrown
by `macroexpand' and throw a syntax error.
(trans-pair): Catch calls to `procedure->memoizing-macro' and raise a
syntax error.
* module/system/base/compile.scm (call-with-compile-error-catch): Made a
macro (a procedure doesn't do the job).
(compile-file): Uncommented call to `call-with-compile-error-catch'.
git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-7
* module/language/Makefile.am: New.
* module/language/scheme/Makefile.am: New.
* configure.in: Produce these two new Makefiles.
* doc/guile-vm.texi: Documented `compile-file', `compiled-file-name', and
`compile-in'.
* module/system/base/compile.scm: Cosmetic changes.
* module/system/base/language.scm: Likewise.
* module/system/il/Makefile.am: Tried (and failed) to compile more
things.
* module/system/vm/Makefile.am: All source files in here can now be
compiled without harming further compilation.
* module/system/vm/assemble.scm: Select only specific bindings from
`(system vm core)'.
(dump-object!): Show a more meaningful error message.
* module/system/vm/conv.scm: Select only specific bindings from `(system
vm core)'.
* module/system/vm/debug.scm: Likewise.
* module/system/vm/frame.scm: Changed the header. Use a renamer for
`(system vm core)'.
* src/guilec.in: Added options, via `getopt-long'.
git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-6
* module/language/scheme/translate.scm (trans-pair): In the `set!' case,
when a procedure-with-setter is passed, call `trans:pair' with an
actual pair. This fixes a long-lasting bug which prevented compilation
of `set!' statements with procedures-with-setter (this showed up when
compiling `(system vm assemble)').
* module/system/base/compile.scm: Added `objcode->u8vector' to the
`#:select' clause.
* module/system/base/syntax.scm: Cosmetic changes.
* module/system/vm/assemble.scm (preprocess): Removed debugging
statements.
* src/frames.c: Cosmetic changes.
* src/frames.h (SCM_FRAME_SET_DYNAMIC_LINK): New.
* src/objcodes.c: Use `scm_t_uint8' instead of `char' when relevant.
* src/vm.c (vm_heapify_frames_1): Use `SCM_FRAME_SET_DYNAMIC_LINK ()'.
* src/vm_loader.c: Added casts to mute GCC 4 warnings.
* testsuite/run-vm-tests.scm (*scheme*): Renamed to `%scheme'.
(run-test-from-file): Renamed to `compile/run-test-from-file'.
(run-vm-tests): Run each test using both the VM and the interpreter;
compare the results.
* testsuite/t-proc-with-setter.scm: Try out `get/set'.
* doc/Makefile.am (info_TEXINFOS): New.
* doc/guile-vm.texi: Added index entries and indices.
* doc/texinfo.tex: New file.
git-archimport-id: lcourtes@laas.fr--2005-mobile/guile-vm--mobile--0.6--patch-5