Sat Mar 7 13:08:13 CET 2009

A new introduction.

After a couple of months of settling time, here's a new basic
introduction to Staapl.


Staapl is a metaprogramming system based on the Forth and Scheme
programming languages.  Staapl currently contains the following
distinct layers:

  * A compiled Forth-like language for the Microchip PIC18
    microcontroller architecture.

  * A language for macro definition and instantiation (target code
    generation) using Forth syntax.  Used to implement the PIC18, and
    written in terms of Coma.

  * A stack-based macro language called Coma.  It can be used for the
    specification of Forth-like stack-based languages ("specification
    by compiler").  Coma primitives generate and process sequential
    imperative machine language (a real stack machine or a RISC
    machine emulating a stack machine).  Coma contains mechanism for
    creating primitives that support partial evaluation based on
    pattern matching.  Coma's composition mechanism (concatenation)
    can be manipulated from Scheme using hygienic quasiquotation.
    Coma is written as an extension of Scat.

  * An untyped stack language called Scat.  Scat is written as an
    extension of the Scheme programming language (PLT Scheme), and is
    very similar to the Joy language.

These layers comprise the layered organization of the stack languages.
Most of the highlevel code is Scheme, and specialized macros written
in Scheme.

How does Staapl differ from its sources of inspiration?

  * Staapl's idea of Forth differs from traditional Forth in that it
    is heavily macro-based: all "words" in Staapl's Forth are macros,
    and macro and procedure definitions are (mostly) the same:
    procedures are instantiated macros.

  * Scat is not Joy, because Scat's code is opaque, while Joy allows
    for direct introspection and creation of code objects using list

  * Coma is not just a macro assembler.  Macros are _programs_ that
    can operate on data (base machine language programs) in arbitrary

  * Staapl is very different from metaprogramming tools based on
    lexical scoping (i.e. MetaML).  Staapl uses using a lexically
    scoped metalanguagelanguage (Scheme) to metaprogram a stack
    language which lacks local variables, avoiding problems with
    lexical scope of the target language.