Thu May 28 07:36:23 CEST 2009

standard forth

Before I loose them again, some useful links [1][2].

So, I have most of the difficult decisions made:
 * Forth is subroutine threaded
 * @ and ! are RAM, flash has separate access words
 * dictionary and code are in separate flash regions
 * dictionary uses Pascal strings
 * , (comma) goes to RAM first, into a circular buffer

Still to solve:
 * terminal input
 * large branches

There is one thing I'm not convinced about.  The threading model.
Maybe it's better to stick to some form of address interpretation.  It
will make things a lot slower, but won't have double sized call words
or chained jumps.

Anyways, I already did a lot of thinking about this, the result of
which can be found in the pic18/vm-core.f code.  I'm again stuck in
this loop of not knowing what to choose: fast or flexible?  Putting it
like this it should of course be flexible.

Can't I have both?  It should be really simple though: for speed, use
the 8-bit Forth.  It's always going to be faster.  For the one on top
of that, use anything that has compatible primitives _and_ has small
code size and maximum flexibility otherwise.

The VM in pic18/vm-core.ss uses threaded code with an exit bit to
implement tail recursion.  It also sees the return stack as code.

Some links

[1] http://astro.pas.rochester.edu/Forth/forth-words.html
[2] http://lars.nocrew.org/dpans/dpans.htm