Sat May 30 14:51:37 CEST 2009
target-directed to-host offloading
Figure out a way to make the tethering protocol bi-directional. The
target should be able to request a computation to take place on the
It's better to use the target's code sequencing to debug code than to
offload this as simulation to the host.
The simplest way to do this is to use a symbolic interface: target
sends a string requesting for a command to execute, and waits for ack.
Ok, so what needs to be done is to find a way to implement the target
Forth's immediate words both as macros (using the host compiler) and
as target words. This by abstracting the dictionary and the compile
The difficulty in writing a Forth in Forth is to abstract the
dictionary, compilation stack and threaded code representation in
such a way that a single specification of all immediate words
(mostly control words) can be used in different compilers.
So, can a very classical way of implementing the control words be
implemented in coma? The problem is that coma uses abstract labels,
not target addresses, and a real forth would use forward jump
But there are only two forms: forward and backward jumps. Both will
save some data on the compilation stack and consume it later.
empty forward jump + hole here -> hole
here backward jump
Bill Muench designed the original eForth 1.0 for simplicity and
portability. It had only 30 words written in assembler and used
only BEGIN_UNTIL BEGIN_WHILE_REPEAT IF_ELSE_THEN and FOR_NEXT in
its source. The second release reduced the number of code words to
28 and removed the FOR_NEXT constructs from the source code and
replaced them with BEGIN constructs. I was pleased to learn this
when I was designing a meta compiler to generate a version of
eForth for a new target. It meant that there were fewer IMMEDIATE
words that were needed in the meta compiler. The meta compiler no
longer needed to compile FOR_NEXT constructs.