3 ms·
The stack is important to Forth, but equally so is its threaded-subroutine-call nature, which isn't present in other early languages that I know of. That puts F
by pulvinar 3y ago
The stack is important to Forth, but equally so is its threaded-subroutine-call nature, which isn't present in other early languages that I know of. That puts Forth halfway between assembly and higher-level (and easier to read) languages. I never saw it as a macro language.
At least that's the viewpoint I'm familiar with from back when we heavily used it.
- turndown 3y agoWhat do you mean by threaded here?
- mikevin 3y ago> What do you mean by threaded here? Here's a good explanation. https://www.bradrodriguez.com/papers/moving1.htm https://www.bradrodriguez.com/papers/moving1.htm
- jasonwatkinspdx 3y agohttps://en.wikipedia.org/wiki/Threaded_code https://en.wikipedia.org/wiki/Threaded_code It's a way of structuring an interpreter. In forth a word is just a pointer to its definition, which in turn is just a list of pointers to other words, potentially user defined or built in primitives. Execution threads through these pointers, much like making subroutine calls with arguments being passed implicitly on the stack. It's much more compact and lower overhead than a classic interpreter walking a full Abstract Syntax Tree structure. These days most languages are going to a full native code JIT however.