Staapl

Staapl (http://zwizwa.be/staapl) is a 2-stage dynamically typed metaprogramming system. It consists of a concatenative transformer language Coma that operates on a stack machine language.

It is based on the ideas that an imperative stack machine model (abstracting a processor as a Forth machine) works well for small embedded microcontrollers, and that metaprogramming and partial evaluation are almost trivially expressed for functional concatenative programming languages due to absence of problems with identifier hygiene.

Staapl's Scheme bridge consists of the dynamically typed functional concatenative Scat language, implemented as a hygienic Scheme macro. In its basic form, Scat is Joy with extensional compositions: code quotations are not lists, but abstract entities represented by Scheme closures. Scat compositions support quasiquotation for (lexically scoped) template programming from Scheme, and use a hygienic name management system based on PLT Scheme's module system. Scat can be given different semantics. This is used to implement Coma, a functional concatenative language that operates on stack machine code. Additionally, Staapl contains a pattern matching mechanism for implementing Coma primitives in Scheme.

Staapl contains a simplified Forth frontend that hides most of the metaprogramming system. This Forth dialect has the standard Forth interpret/compile metaprogramming removed and replaced with a mechanism based on partial evaluation and template macros. It is possible to use the Forth language as a stand-alone programming system.

Staapl is implemented as a library for PLT Scheme, and currently contains a PIC18 code generator backend.

This revision created on Tue, 23 Sep 2008 07:08:59 by doelie