Mon Mar 31 08:59:52 EDT 2008
exit: jump to end
now for 'exit'. what i want to support is words/macros like this:
... if ; then ...
the ';' is exit for ordinary words, but it's jump-to-end for
macros. the 'end' is defined in the environment that executes a single
macro. there's no way to do this except for wrapping each macro.
ok. so, split it in 2 parts.
* meaning of ';'. for macros, it means 'exit-macro', for words it
* implement 'exit' and 'exit-macro'.
not that local macro exits always occur within some conditional
construct which ALSO introduces splits. can this be used somehow? or
is it better to optimize this away when eliminating empty words?
aha. the label is that for the code AFTER the exit, not the code it
exits TO! they's different!
seems to work. note: this allows dead code elimination: anything
present in a word's code body AFTER exit or jw can be eliminated. this
allows to turn jw/nop -> jw making code re-arrangement possible. dead
words are then eliminated by just not being reachable.
the next problem that pops up is interference between 'exit' and how
it is used in optimizations. basicly, 'exit' needs to be a parameter.
seems to work.
one more problem: if the last word in a macro is ';', it doesn't need
to split: would create too many spurious words.
maybe the ';' thing can be checked at (scheme) compile time? the
problem is that this really needs semantics.. so, no.. maybe propagate
source location information to at least give proper error message?
ok. wasn't so difficult: srcloc is now passed from compile time to be
stored in the target word structure, or used in macro error reporting.