Mon Nov 7 16:44:03 EST 2011
I'm thinking about what to do next with the synth. The main problem
is that I don't have a good way to deal with state machines and
building dataflow networks, or at least event sending..
State machines can be well represented using python-style coroutines,
which are essentially threads with only one cell, meaning that yield
can only be called at the entry level.
It would be nice to have some global compiler support for doing jump
table allocation for this mechanism, since RAM is so expensive and
most state machines can do well with 256 states.
The problem then is how to find "islands of control" that can use
disjunct control points? It might be best to do this with an extra
context, as we also need to enforce that yield is not used is library
- Islands of control: collect words that are separated by tail calls
only. Doing this automatically is possible, but would require it to
be done on a low level.
- Explicit declaration might be better, something like:
begin-sm <entry> ... end-sm
This way the context for this can be stored in a threaded compiler
state, and we can enforce that all calls inside such a section are
actually tail calls.
- Python-style generators/coroutines do not allow calling `yield' from
nested context, which is exactly the point here since we want to
save memory and resource allocation hassle. However, in Staapl
nesting that doesn't use any data state can still be done using
macros, which would expand into multiple control points.
- It needs an extra compiler state. It might be better to first make
compiler states composable, or provide a way to attach some state
for later extension.