Thu May 15 14:15:51 CEST 2008

org and fallthrough

Another example where a collision of two or more seemingly trivial but
annoying problems that resist elegant solution in the current paradigm
leads to a better paradigm.

Because of fallthrough, which is a low-level property of assembly code
i don't like to give up in the PURRR language, the order of words is

However, words that ORG at a different address are independent of
those that came before, and words that EXIT are independent of those
that come after. This can easily be reflected by adding a 2nd level of
nesting in the representation of a target word collection:

        (deque-of (stack-of target-word?))

The operations are:

    * EXIT/ORG: create a new current-fallthrough list (with possible associated address)
    * QUEUE:    move current fallthrough list to the end

What data structure is this?

  * access top element :: (stack-of target-word?)
  * add new element to the top
  * move top element to bottom

So, it's a combination of stack and a set, implemented using an
assymetric deque. Stuff popped off the stack is recorded in the set
(and looses its order).

Actually, it might be implemented as 2 stacks directly.

Now, there's a deeper problem: this accumulation needs to span across
words, so the point where words are already packaged needs to be
modified to allow accumulation.