2 ms·
It is possible to implement a real forth in this language.. but it would be as slow as molasses in January. You can get the depth of the stack, you can swap arb
by mikewarot 6y ago
It is possible to implement a real forth in this language.. but it would be as slow as molasses in January. You can get the depth of the stack, you can swap arbitrary positions of the stack, and do math... so you could build a system of fixed allocation of memory IN the stack, which means you could then compile new definitions
The interpreter doesn't add like forth... it leaves the 2 values to be added still on the stack... you have to do "glblb" to do a normal add, for example.
A fun exercise, but not a language I'd want to work with.
Edit: Specifically missing are any ways to persist variables, or allocate memory. Yes, you could fake all of that with some very careful coding, but a single mistake or clear stack (y) would send it all tumbling down.
- hansvm 6y ago> but a single mistake or clear stack (y) would send it all tumbling down. This seems especially prone to some kinds of nasty bugs if you're not careful with what you're doing: Would you like to save your progress? [y/n] >> y