[stack] Re: Properties of Concatenative langauges and Forth
"pml060912" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
--- In [email protected], "Christopher Diggins" <cdiggins@...> wrote: . . . > Forth without compile-time words isn't Turing-complete as far as I can > tell. Yes, it is (ignoring the fact that implementations are finite), because it's a TWO stack machine. (I'm assuming the memory addressing operators @ and ! aren't allowed for the purposes of this discussion.) I don't think you can just give it a pass. Can you even > construct a conditional expression in Forth without compile-time > words? Yes, actually. You can change the default compiler behaviour to close secondaries with a branch back to the beginning instead of a return, so the default is an infinite loop, and then use a conditional return ?R which consumes a true/false flag on the stack. If you get rigorous about not even allowing the compiler to have a compile time keyword to terminate it, you can do what I did with Furphy (for just that reason, to avoid making "special" words fundamental). That uses Reverse Polish naming, so that the first unrecognised token both terminates and names a secondary. I took that approach even further, to make Furphy modeless (more precisely, it has a single compile and go mode where Forth has distinct execution and compile modes).