Just thinking out loud here about a Forth implementation to try out:
After porting a Forth with traditional indirectly-threaded word definitions (as implemented in JonesFORTH), I’d like to try some alternatives.
4 bytes - link to prev word 1 byte - length of name + flags n bytes - (string) name, no 0 termination address of "interpreter" DOCOL, which executes the rest... address of word_a address of word_b address of word_c [fetch next instruction and jmp to it]
A Call/Return Forth would instead have the much simpler
4 bytes - link to prev word 1 byte - length of name 1 byte - flags n bytes - (string) name, maybe consider 0 termination to aid in debugging call word_a call word_b call word_c ... ret
The idea is that we’re trading the size of the machine instruction for
call with the complexity of the indirect threading model. It’s a size vs simplicity and (likely) execution speed tradeoff.
I’m really curious how the two would compare in benchmarks for typical tasks.