Re: [stack] are concatenative languages applicative?
Manfred Von Thun <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <C43E31C5.10E1%[email protected]> |
On 25/4/08 11:58 AM, "Don Groves" <[email protected]> wrote: > On Apr 24, 2008, at 3:10 PM, John Nowak wrote: > >> > First off, let me say that I'm not particularly interested in if Joy's >> > 'i' is an 'eval'. This does, as Chris pointed out, seem to get us >> > bogged down in implementation details. > Emphatically, it is not an implementation detail. Any programming language ultimately runs in machine language, which is sequential (with jumps, though). At intermediate levels it can be implemented in functional or in procedural languages. Any functional language can be implemented in a functional or a procedural language, or by rewriting even concurrent rewriting. The details of the rewriting will depend on the syntax of the functional language. For a concatenative language, here is a (crazy, but correct) algorithm for rewriting an expression in the language, using several clerical workers concurrently: > REPEAT: The workers at random select an operator in the expression. If it is immediately preceded by the appropriate number of operands, replace the operands and the operator by a value. (For example, (... 2 3 + ...) is replaced by (... 5 ...).) UNTIL there are no more operators in the expression > This is a way of implementing any concatenative language, even if crazy. The usual stack implementation of concatenative languages is just an efficient way of finding operators that are immediately preceded by their operands. Whether Joy¹s i combinator is an eval is a semantic question that is independent of the implementation, whether by stack or by rewriting. > - Manfre [Non-text portions of this message have been removed]