Concatenative programming language
From open-encyclopedia.com - the free encyclopedia.
In concatenative programming languages, the concatenation of appropriate programs denotes the composition of the functions which the programs denote. Operations map an input stack into a results stack, and so it is possible to repeatedly concatenate a sequence of operations.
A programming language is concatenative (and not applicative) when:
- The elementary well-formed expressions of the language are monadic functions of a nameless data stack.
- If X and Y are well-formed expressions, then the concatenation of X and Y is well-formed.
- If Z is the concatenation of X and Y, then the value of Z is the composition of the values of X and Y.
Examples
The canonical examples of concatenative programming languages are Forth and Joy. In Joy, the program fragment:
- 2 7 +
Pushes "2" then "7" onto the stack. The "+" operator then replaces the stack with a new stack that contains the resulting sum "9".
The Category:Concatenative programming languages contains an exhaustive list of those known to Wikipedia.
External links