Planula
Planula is a Scheme implementation written in portable ANSI C, with a little bit of C99. It can be compiled with TinyCC, which means it can be bootstrapped into with GNU Mes.
Planula primarily exists not to be a Good Scheme Implementation, but
to be a foundation for bootstrapping a development environment on my Lisp OS,
Reef, once Reef development properly begins. Avoiding using any
features or library functions not outlined in C99 or earlier will make
it much easier to compile for Reef with a portable library like mlibc
as a basis.
Planula will be used to write Lime, a Scheme compiler suitable for low-level programming and kernel development, and the Reef kernel will be written in that dialect. Then, Lime will be used to write a more sophisticated Scheme interpreter, Polysp, which will actually try to be a Good Scheme Implementation, and the basis for Reef's userland.
To-do
Planula currently has most of the very basics of an R7RS-compliant Scheme. It does still lack a few important features, however:
- Exceptions are only partially implemented; the
EXCEPTION
type exists, and theerror
procedure exists to create them, but there is no mechanism yet for error handlers. - Hygienic macros are not yet implemented, but unhygienic macros seem
to be ready to go. Some macro hygiene is possible through
gensym
. An implementation of true Scheme-style pattern matching withsyntax-case
is definitely a wishlist feature before Lime development begins. - A lot of standard library functions need implementing. So far, I've really only implemented the ones that proved necessary while I was working on getting macros working.
- Could stand to implement some tests just to properly verify behavior correctness.
- Currently there is no procedure to fully expand a macro without
evaluating it, since macro evaluation happens at
runtime. Previously, I attempted to do macro evaluation as a
preprocessing step, but the implementation proved tricky and
overcomplicated. Ideally though, we could test macros with something
like
macroexpand
, or expand all macros prior to code evaluation, but since this is strictly an interpreted Scheme and not a compiled one, that's probably not horribly necessary.