Thu Mar 27 19:22:22 EDT 2008
let's say that 'exit' always means return, even in macros. but ';' means
macro: jump to end
how to implement "jump to end" ?
this requires labels.
so.. what is a label? an entry point. a word.
let's see.. there are 2 kinds of fork points:
* conditional goto (not call!)
* entry / label
so.. a macro can split a word?
x x x then y y y
this turns the ys into a different word. the place where this would
happen is in target-rep.ss in macro->code:
that call might return multiple words. the first one being the
original word, but other ones made of chunks, where each chunk is an
entry or fork point.
note that this is almost the same as the splitter for parsing forth
definitions. why are they not completely the same? problem with the
forth parsing requires a function return because of 'rpn-next', while
the code splitter doesn't..
so.. this needs to be brought to the level of words (which have
names), not code lists. OK done that.
so.. what needs to be a word? jump targets. the reason is simple: jump
sources are clearly visible (idally, a word would be ONLY jump
sources), but targets are not. maybe in a later step also eliminate
sources? anyways. there's 2 kinds of jump targets: forward references
(if .. then) and backward references (loops).
OK: it's basicly like it was before, but labels are now references to
word structures (created when the label is created) and created by the
'label' macro. these are used by the 'split' word to start filling the
word structure with code.