▲ | crq-yml 2 days ago | |
You've implemented a stack calculator, which misses the big picture: the stack is an implementation detail that enables a lot of the nifty stuff, but Forth is a "braided language" - the whole is more than the sum of the parts. Each part of it is just implementation, and the implementation is kept simple, but all of it needs to be there to make it completely usable. The distinction is important and non-trivial to the design of the interpreter. To get there, please implement some of the metaprogramming words found in one of the standardized Forths(and if you aren't sure which one, use an earlier spec like Forth83 since the core wordset is smaller, so you run into the "hard stuff" faster). Forth used in anger towards an application actually tends to resemble Fortran: procedural idioms flinging around lots of named temporary variables. The stack, being just implementation, doesn't give any assistance for everyday programming, unless you extend the system to do so. This is a point on which modern concatenative languages have diverged and tried to add some rigor into it. |