Sun Jun 1 10:54:22 CEST 2008
rethinking code instantiation
it's frankly too complicated and ad-hoc atm.. i lost oversight. these
features/choices make it complicated:
* forth words have associated macros
* multiple entry and exit points
* forth parser is a single macro, but uses factored macros
macros are really simple (declarative), but forth syntax +
instantiation makes it a lot more difficult.
code instantiation produces a single macro that runs with
compilation-state to produce a collection of fallthrough words. This
is the remainder after lifting out all macro and parser definitions.
what about making instantiation an operation on macros? i.e. replace a
macro with a wrapper, and collect the body instantiation
somewhere. this doesn't work for multiple entry points though..
so: multiple exit is easy: it's simple to fake in macros using a
'macro return stack' in compilation-state. multiple entry points
however is quite difficult.
is it possible to do this?
1. bring the representation back to single entrypoint
2. write multi-entry point code / fallthrough as an optimization
i don't think so.. there is too much code that relies on multiple
entry points. i need a simpler way to represent it.