Concatenative programming language
Encyclopedia
A concatenative programming language is a point-free programming language in which all expressions denote functions
and the juxtaposition of expressions denotes function composition
. The combination of a compositional semantics with a syntax
that mirrors such a semantics makes concatenative languages highly amenable to algebraic manipulation.
Much of the original work on concatenative language theory was carried out by Manfred von Thun.
, Onyx, PostScript
, RPL, Stappl, Trith and XY.
Most existing concatenative languages are stack-based; this is not a requirement and other models have been proposed. Concatenative languages are currently used for embedded, desktop
, and web programming, as target language
s, and for research purposes.
Most concatenative languages are dynamically typed. One exception is the statically typed Cat language.
Function (mathematics)
In mathematics, a function associates one quantity, the argument of the function, also known as the input, with another quantity, the value of the function, also known as the output. A function assigns exactly one output to each input. The argument and the value may be real numbers, but they can...
and the juxtaposition of expressions denotes function composition
Function composition
In mathematics, function composition is the application of one function to the results of another. For instance, the functions and can be composed by computing the output of g when it has an argument of f instead of x...
. The combination of a compositional semantics with a syntax
Syntax of programming languages
In computer science, the syntax of a programming language is the set of rules that define the combinations of symbols that are considered to be correctly structured programs in that language. The syntax of a language defines its surface form...
that mirrors such a semantics makes concatenative languages highly amenable to algebraic manipulation.
Much of the original work on concatenative language theory was carried out by Manfred von Thun.
Properties
The properties of concatenative languages are the result of their compositional syntax and semantics:- The reduction of any expression is the simplification of one function to another function; it is never necessary to deal with the application of functions to objects.
- Any subexpression can be replaced with a name that represents the same subexpression. This is referred to in the concatenative community as factoring and is used extensively to simplify programs into smaller parts.
- The syntax and semantics of concatenative languages form the algebraic structure of a monoidMonoidIn abstract algebra, a branch of mathematics, a monoid is an algebraic structure with a single associative binary operation and an identity element. Monoids are studied in semigroup theory as they are naturally semigroups with identity. Monoids occur in several branches of mathematics; for...
. - Concatenative languages can be made well-suited to an implementation inspired by linear logicLinear logicLinear logic is a substructural logic proposed by Jean-Yves Girard as a refinement of classical and intuitionistic logic, joining the dualities of the former with many of the constructive properties of the latter...
where no garbageGarbage (computer science)Garbage, in the context of computer science, refers to objects, data, or other regions of the memory of a computer system , which will not be used in any future computation by the system, or by a program running on it...
is ever generated.
Implementations
The first concatenative programming language was Forth, although Joy was the first language to call itself concatenative. Other concatenative languages are Cat, Enchilada, FactorFactor (programming language)
Factor is a stack-oriented programming language created by Slava Pestov. Factor is dynamically typed and has automatic memory management, as well as powerful metaprogramming features. The language has a single implementation featuring a self-hosted optimizing compiler and an interactive development...
, Onyx, PostScript
PostScript
PostScript is a dynamically typed concatenative programming language created by John Warnock and Charles Geschke in 1982. It is best known for its use as a page description language in the electronic and desktop publishing areas. Adobe PostScript 3 is also the worldwide printing and imaging...
, RPL, Stappl, Trith and XY.
Most existing concatenative languages are stack-based; this is not a requirement and other models have been proposed. Concatenative languages are currently used for embedded, desktop
Application software
Application software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...
, and web programming, as target language
Target language
Target language may refer to:*Target language, in applied linguistics and language education, the language which a person is learning, also called second language*Target language, in translation, the language to which a source text is translated...
s, and for research purposes.
Most concatenative languages are dynamically typed. One exception is the statically typed Cat language.
See also
- Function-level programmingFunction-level programmingIn computer science, function-level programming refers to one of the two contrasting programming paradigms identified by John Backus in his work on programs as mathematical objects, the other being value-level programming....
- Stack-oriented programming languageStack-oriented programming languageA stack-oriented programming language is one that relies on a stack machine model for passing parameters. Several programming languages fit this description, notably Forth, RPL, PostScript, and also many Assembly languages ....
- Tacit programmingTacit programmingTacit programming is a programming paradigm in which a function definition does not include information regarding its arguments, using combinators and function composition instead of variables...
- HomoiconicityHomoiconicityIn computer programming, homoiconicity is a property of some programming languages, in which the primary representation of programs is also a data structure in a primitive type of the language itself, from the Greek words homo meaning the same and icon meaning representation...