Tue Mar 29 11:40:48 EDT 2011

Forth Syntax

Staapl is a descendant of a Forth compiler[1].  It is a point in a
long line of iterations to rewrite the original in Racket (PLT Scheme)
using and learning about the approach native to Racket: powerful
hygienic macros.

I've gone to great lengths to try to maintain a Forth syntax frontend
despite of the core going through several makeovers while absorbing
new Racket abstractions and approaches.  Recently I was weighing the
idea of dropping Forth syntax completely because of the tension it
creates with the Racket macro & module framework.  Eventually, I was
able to push the workarounds behind an interface, thinking it was
better to not break what worked before, but intending to not use it
for newer work.

However, some recent work on low-level PIC code has lead me to
re-apprecite the usefulness of Forth syntax and mindset.  Maybe it's
just what I'm used to (and the emacs syntax highlighting ;) but for
writing straight line code it is a very good user interface.  Combined
with the the interactive incremental setting which allows quick
one-line function definitions to run ad-hoc tests on the PIC, it is
quite powerful.

So it's probably going to stay.

In any case, all functionality that used to be only available in the
Forth syntax is now available in s-expression form without the prefix
parser construct.  The latter is very hard to reconcile with
s-expression macros in the current approach.  I plan to rewrite the
old Forth parser on top of the new s-expression format (now it's
special-purpose) but we'll see if there's time and necessity.

[1] http://zwizwa.be/pic/badnop