Mon Jun 8 17:53:54 CEST 2009
Started staapl/machine/dfl.ss -- the essential idea is to use Scheme's
scoping mechanism to build a DFG, and then simply execute that graph.
Compilation can be performed by recording a successful trace.
Actually, code can be split up even more:
1. recursively create and connect nodes
2. serialize (try to resolve the dependencies)
The first two steps can be done statically. The structure this
produces (a bunch of nodes and a sequential program) can be abstracted
into a state update function that can then be optimized to use
registers more effectively.
But: this solves the real problems:
- PRIMITIVES are implemented as primitive scheme n->1 functions.
- COMPOSITION is graph construction (where nodes are lexical
variables), reducable to a scheme procedure.
Hard to express, but what I find remarkable is that for a DFL,
compilation seems to be natural. Maybe because composition naturally
decomposes into a BIND and a RUN phase, because of its graph nature.
Graphs expressed linearly (as a list of ops) always require 2 passes
to close the references.
Note that currently, macro-expanding everything isn't necessary: it is
possible to re-use subnets, by abstracting them. The registration
should thus be captured by the "abstraction" construct. In other
words: how to turn a composite back into a primitive.