Thu Dec 30 15:32:11 EST 2010
S-expression based syntax
I started an effort to provide an s-expression based syntax for
instantiated target words. The big difference with macros is that
target code is inherently flat, i.e. it uses labels instead of
I'm not sure if that's the right way to go, but the low level control
flow access you get in this way is at least useful. However it might
turn out to be better to use a higher level function-based abstraction
later on, and provide some guarantees in the code generation phase.
But really, I'm not going to fuss about that now. Target code is
flat, and this flatness is accessible.
words-flat : Define a sequence of (name . code) pairs with
fallthrough. This is essentially the stack-based
words : On top of `words-flat', define a list of (name . code)
pairs where code has implicit `exit'.
variables, variables-flat: Same, but for reserving RAM space.
Having the code available in s-expression form allows PLT units to be
used for parameterization. In short, the Forth parser is too
convoluted to be able to blend in unit support. This is caused by the
flatness of the Forth language, and the fact that names can be
introduced along the way.
If possible I'd like to save the Forth syntax on the long term.
However this would require some serious redesign. Currently it is
kept as-is. New developments will be implemented in the s-expression