and, or, cond etc use syntax-rules, compile scheme through tree-il
authorAndy Wingo <wingo@pobox.com>
Wed, 20 May 2009 09:15:22 +0000 (11:15 +0200)
committerAndy Wingo <wingo@pobox.com>
Wed, 20 May 2009 09:15:22 +0000 (11:15 +0200)
commita1a482e0e9518b5711bc2734aa014254f9207919
tree05d7dcc353f72749e6dd484555b4be86b072b4fe
parentce09ee19892d391f3b2ca13e0616d343929c2c14
and, or, cond etc use syntax-rules, compile scheme through tree-il

* 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.
libguile/vm-engine.h
libguile/vm-i-system.c
module/ice-9/boot-9.scm
module/ice-9/psyntax-pp.scm
module/ice-9/psyntax.scm
module/language/scheme/compile-tree-il.scm
module/language/scheme/spec.scm
module/language/tree-il/analyze.scm
module/language/tree-il/compile-glil.scm
module/language/tree-il/optimize.scm
test-suite/tests/tree-il.test