The bootstrap implementation of Lunar consists of a compiler and runtime written in Common Lisp. The compiler translates into Common Lisp code. Numbers, booleans, and strings use their Common Lisp representations, all other data are represented using CLOS classes whose class name is the Lunar class name, prefixed with "lunar-" if necessary to avoid a name conflict. A multi-slot is represented as a slot whose value is a simple-vector.
Each Lunar method is translated into a Common Lisp function with a generated name. The translated code can call a method directly if it is sealed and the compiler can determine that it is applicable at the call site. Otherwise, all calls go through a lunar-call function which does method selection.
The bootstrap implementation supports a subset of Lunar sufficient to experiment with parts of a "real" implementation. It does not include floating point, non-ASCII characters, generic classes or methods, error checking in method selection, casting and delegation, named parameters, destructuring, string interpolation, sets, maps, comprehensions, catch and throw, and exceptions. It only does the minimal type inference and sealed method inlining needed for bootstrapping, and only supports a very simplified form of the for statement.
Unfortunately I never finished this, and what code exists is completely broken and does not work at all. It might be better to start over with a fresh implementation.
Previous page Table of Contents