Science Fair Project Encyclopedia
Concatenative programming language
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 to create a program.
A programming language is concatenative (and not applicative) when:
- The elementary well-formed expressions of the language are monadic functions of one argument and one return value.
- 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.
In this definition, there is no mention of the stack, and it is theoretically possible to have a concatenative language without a stack, but in practice, no such language exists. This precise definition of concatenative languages is very contravercial, and the actual meaning of "concatenative" is frequently debated.
Arguably, Forth was the first concatenative language, but Joy was the first language to call itself concatenative. The creator of Joy, Manfred von Thun , has written much about concatenative theory. The category Concatenative programming languages contains an exhaustive list of those known to Wikipedia.
Examples
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", this notation is also known as "Reverse Polish notation".
External links
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details


