Mon May 14 17:28:48 EDT 2012

Stream-oriented machine

I found a use case for it, so let's set up the basic architecture:


  LIT ( -- n )               copy byte from instruction stream to stack
  CPY ( n -- ... )           copy n bytes from instruction stream to stack
  EXC ( .. addr n -- )       execute C ABI
  LOK ( n -- addr n )        lookup addr/nb32bitargs

LIT 4 COPY 1 2 3 4

Then, it would be nice to be able to define a shortcut like this:

DOFUN <codebyte> <arg> ....

This way it's possible to get the forth machine through the company
management, making it do something useful first, and then extending it
with all kinds of Forth goodies ;)

Can this use the trick of loading the return stack with opcodes?  If
opcodes are both primitives and calls, this might work.