I'm developing an optimiser for the new version of win32forth that
employs the method of simulating at compile time (using smart compile,)
the stack effects of basic blocks. Anton has several papers that discuss
this method (the RAFTS papers) and I believe VFX using a similar (the
same?) technique.
http://www.complang.tuwien.ac.at/papers/ertl&pirker96.ps.gz
I've grasped the idea of "before" and "after" stacks, and building a
data flow graph from the primitives, with the following fairly simple
classes of words;
Class 1. execute stack manipulation words that have no side effects
(such as modifying memory) such as DUP SWAP etc.
Class 2. don't execute, but add to the DFG by popping/pushing based on
the word's stack effects and point to the operands on the stack.
Class 3. terminate at other words and build a DFG for the basic block
The bit I can't get my noddle around are parsing words like TO and S" .
Here's the output from my intelligent compile, parse tree for TO
0 value y ok
: x 10 to y ;
outputs the tree for x of