Wed Jun 25 20:29:13 CEST 2008
In the current compiler there are 4 stacks. Following the previous
remarks about concentrating on rewriting first, the order will
probably change to this:
1. Assembly stack, contains target assembly code and is used for
target code rewriting. (in Forth compilers this is the allot
buffer. in non-rewriting compilers it grows monotonically.)
2. The Forth Control stack, used for recording jump labels to
implement looping and conditional structured programming constructs
3. The dictionary stack: (actually a set of stacks, supporting
multiple entry points / fallthrough and control flow analysis)
4. The macro exit stack: for supporting multiple exit points in forth
style macros. (an emulated run time stack).
Only the first one is essential for Pure Purrr (Puurpr, Purrepr, ...
Paars?). The other ones are there to support Forth's state in a
functional macro system + give some freedom to exchange macros and
instantiated words and perform control flow analysis.
The problem I mentioned before is that the Forth approach with
separate control stack is a bit of a dead end, since it's not a very
structured way of dealing with code. Macro quotations are probably a
lot better. Unfortunately, there is no simple way to convert forth
syntax to quoted macros, without getting rid of the control stack.
5. Probably, in a language based on 1. with automatic instantiation
(otherwise there would probably be some kind of code explosion), a
stack of instantiated words might need to be added. However, this
is just a write-only registery (log).