Combuster wrote:Based on what Wikipedia has to say on Forth, there are two primitive instructions in the language:
push immediate (store it as a tag, and the immediate)
call word (store as a tag, and a reference to the word's name)
No. There's more than a few words needed to bring a Forth up. Different authors have a different set of primitives. As one example the UK FIG suggest NEXT, ENTER, EXIT, DOVAR, DOCON, LIT,& @, !, +, BRANCH, ?BRANCH, SWAP, >R, R>.
Combuster wrote:
Because you're not compiling, you can't create functions to load predefined variables, nor can you create functions for newly defined words - or altered ones. And because aritrary numbers can be anything, distinguishing them by address doesn't work either.
The instruction LIT takes care of literal data. He doesn't need to parse literal data at run time, LIT knows that literal data will follow it. Now, if he inlines subroutines then he could very well be compiling and he could very well generate machine code to load predefined variables. It's just that he passes all arguments via explicit Forth stack pushes. See Andy Valencia's VAX Forth for an example of that.
Combuster wrote:
Hence if you insist on using threaded mechanics, the logical solution would be to define functions as tuples of the interpreter code responsible for the operation, and any arguments to make it happen - because one value is not going to cut it.
You've just halved his code density and removed any opportunity to use any of the common Forth execution models out there.