Sun Jan 10 10:11:57 CET 2010

How do deal with improper phase separation?

There is such a huge difference between implicit behaviour
(i.e. stateful sequential bootstrap) and explicit declaration (clear
phase separation).

It shows up clearly when writing a compiler for a system without phase
separation (sequential bootstrap).  Figuring out the dependencies
between code to separate compile time code from run time code objects
is non-trivial.

In case of non-separated phases it seems that the simplest such
algorithm is to EMULATE all macros defined in terms of the target
language on a (sandboxed) VM, as the static semantics of the language
can change in quite arbitrary ways during sequential bootstrap, and
such changes can't be simply transformed to run on the host as part of
the compiler.

More precisely:

  - run the compiler + low level macros that define the kernel
    language on the host.

  - incrementally compile target code

  - emulate any bootstrapping macros encountered in the source
So, essentially, looking at this from the target's perspective, the
bootstrap compiler behaves as a magic external component that can be
completely replaced at the end of the incremental bootstrap process,
as it can then be defined in terms of already compiled macros.