Esoteric programming language
|This article needs additional citations for verification. (February 2011)|
An esoteric programming language (sometimes shortened to esolang) is a programming language designed to test the boundaries of computer programming language design, as a proof of concept, or as a joke. The use of esoteric distinguishes these languages from programming languages that working developers use to write software. Usually, an esolang's creators do not intend the language to be used for mainstream programming, although some esoteric features, such as visuospatial syntax, have inspired practical applications in the arts. Such languages are often popular among hackers and hobbyists.
Usability is rarely a goal for esoteric programming language designers—often it is quite the opposite. Their usual aim is to remove or replace conventional language features while still maintaining a language that is Turing-complete, or even one for which the computational class is unknown.
- 1 History
- 2 Esoteric programming terms
- 3 Internet community
- 4 Examples
- 5 References
- 6 External links
The earliest, and still the canonical example of an esoteric language was INTERCAL, designed in 1972 by Don Woods and James M. Lyon, with the stated intention of being unlike any other programming language the authors were familiar with. It parodies elements of established programming languages of the day, such as Fortran, COBOL, and assembly language.
Early implementations of INTERCAL were tied to the IBM System/360 and an unidentified Atari computer (probably the Atari 2600) and have not survived. For many years INTERCAL was represented only by paper copies of the INTERCAL manual. The language's revival in 1990 as an implementation in C under Unix stimulated a wave of interest in the intentional design of esoteric computer languages.
In 1992, Wouter van Oortmerssen created FALSE, a small stack-oriented programming language, with syntax designed to make the code inherently obfuscated, confusing, and unreadable. It also has a compiler of only 1024 bytes. This inspired Urban Müller to create an even smaller language, the now-famous brainfuck, which consists of only eight recognized characters. Along with Chris Pressey's Befunge (like FALSE, but with a two-dimensional instruction pointer), brainfuck is now one of the most well-supported esoteric programming languages. These are canonical examples of minimal Turing tarpits and needlessly obfuscated language features. Brainfuck is related to the P′′ family of Turing machines.
Esoteric programming terms
A Turing tarpit is a Turing-complete programming language whose number of commands, operators, or equivalent objects is very small. These include brainfuck (8 commands, all with 0 operands), OISC (1 command, 2 to 3 operands), and Thue (1 command, 2 operands).
A turning tarpit is a Turing tarpit with a stateful encoding, i.e. a language in which commands are used to select from a finite range of operations and apply these operations to the current state of the program. Examples include reMorse, Whirl and, arguably, INTERCAL.
A method of encoding programs, such that each substring of the encoding is an instruction to both:
- Locate the next instruction in a list, and
- Apply it to transform the current program state.
Note that a single instruction always includes two sequential phases: choosing an operation, and executing it. The list of operations may either be static – as in reMorse or THRAT - or dynamic - as in reMorse4ever.
Here is an example based on reMorse or THRAT:
Select Next Operation in list Perform Operation
The paradigm of a language can fall into a number of categories, and these categories are used to get a general understanding of the way that a specific language operates. These include imperative languages such as brainfuck, in which instructions describe how to change data; functional languages such as Unlambda, in which data and code are more or less interchangeable and execution is the repeated application of functions to the results of other functions; and rewriting languages such as Thue, in which transformation functions are applied to an initial state.
A funge is an esoteric programming language which models its programs as metric spaces with coordinate systems (often, but not necessarily, Cartesian) and which execute instructions located at points in their program space by moving an instruction pointer (a position vector which indicates the currently executing instruction) through that space. Different instructions determine the direction in which the instruction pointer moves, and consequently, the sequence of instructions that is executed.
The current official standard for the behaviour of these programming languages is the Funge-98 specification. This specification is a generalisation of the semantics of the Befunge programming language, which has a two-dimensional toroidal topology. Languages which adhere closely to this standard, such as Unefunge (one-dimensional) and Trefunge (three-dimensional), are sometimes called funges, while more "distant relatives" which differ in significant respects, such as Wierd, are referred to as fungeoids.
For a deterministic language, if one is given the current state of a program, the next state can always be predicted. This is not true for a nondeterministic language. Most languages are deterministic, but some languages, such as Befunge, supply a built-in randomization instruction. Moreover, languages such as Java2k have only randomized instructions. Thus, getting even trivial programs to have a reliable output is often a monumental task.
Nondeterministic languages can be used to explore large search spaces, such as grammars, where exhaustive search is impractical. Random text generators such as the Dada Engine and rmutt are examples of this kind of nondeterminstic language.
More esoterically, nondeterministic algorithms have been employed in the theoretical investigation of hypercomputation.
There is a small but thriving community on the Internet of hobbyists who program in and design esoteric programming languages, currently centered around the Esolang wiki (see below).
The esolang community is active sporadically, and topics of discussion range from debate as to whether a language is Turing-complete to how one would go about representing abstract and hard to visualise mathematical concepts in a programming environment. There is a mailing list, but it is nearly abandoned and most discussion happens on the wiki or on IRC.
Turing completeness is a favorite topic of discussion, since it is not immediately obvious whether or not a language is Turing complete, and it often takes rather large intuitive leaps to come to a solution. New languages with new features are always being created, so proof of Turing completeness is always a challenge.
A related pursuit among programming language enthusiasts is the writing of obfuscated code.
Below are some characteristic examples of esoteric programming languages:
Befunge and its ilk allow the instruction pointer to roam in multiple dimensions through the code. For example the following program displays "Hello World" by pushing the characters in reverse order onto the stack, then printing the characters in a loop which circulates clockwise through the instructions [>], [:], [v], [_], [,], and [^].
"dlroW olleH">:v ^,_@
Binary Lambda Calculus is designed from an Algorithmic information theory perspective to allow for the densest possible code with the most minimal means, featuring a 29 byte self interpreter, a 21 byte prime number sieve, and a 112 byte Brainfuck interpreter.
Brainfuck is designed for extreme minimalism and leads to obfuscated code, with programs containing only 8 distinct characters. e.g. the following program outputs "Hello World!":
Chef by David Morgan-Mar is a stack-oriented programming language designed to make programs look like cooking recipes. Programs consist of a title, a list of variables and their data values and a list of stack manipulation instructions. Despite the first stated design principle requiring that "Program recipes should not only generate valid output, but be easy to prepare and delicious.", most programs consist of ingredients in combinations and quantities that would result in food that is barely edible (if at all). One exception to this is Hello World Cake with Chocolate sauce:
Hello World Cake with Chocolate sauce. This prints hello world, while being tastier than Hello World Souffle. The main chef makes a " world!" cake, which he puts in the baking dish. When he gets the sous chef to make the "Hello" chocolate sauce, it gets put into the baking dish and then the whole thing is printed when he refrigerates the sauce. When actually cooking, I'm interpreting the chocolate sauce baking dish to be separate from the cake one and Liquify to mean either melt or blend depending on context. Ingredients. 33 g chocolate chips 100 g butter 54 ml double cream 2 pinches baking powder 114 g sugar 111 ml beaten eggs 119 g flour 32 g cocoa powder 0 g cake mixture Cooking time: 25 minutes. Pre-heat oven to 180 degrees Celsius. Method. Put chocolate chips into the mixing bowl. Put butter into the mixing bowl. Put sugar into the mixing bowl. Put beaten eggs into the mixing bowl. Put flour into the mixing bowl. Put baking powder into the mixing bowl. Put cocoa powder into the mixing bowl. Stir the mixing bowl for 1 minute. Combine double cream into the mixing bowl. Stir the mixing bowl for 4 minutes. Liquify the contents of the mixing bowl. Pour contents of the mixing bowl into the baking dish. bake the cake mixture. Wait until baked. Serve with chocolate sauce. chocolate sauce. Ingredients. 111 g sugar 108 ml hot water 108 ml heated double cream 101 g dark chocolate 72 g milk chocolate Method. Clean the mixing bowl. Put sugar into the mixing bowl. Put hot water into the mixing bowl. Put heated double cream into the mixing bowl. dissolve the sugar. agitate the sugar until dissolved. Liquify the dark chocolate. Put dark chocolate into the mixing bowl. Liquify the milk chocolate. Put milk chocolate into the mixing bowl. Liquify contents of the mixing bowl. Pour contents of the mixing bowl into the baking dish. Refrigerate for 1 hour.
Although it reads as if it has been through a bad automatic translator and contains a few confusing instructions, it can be followed as a recipe that results in a cake with chocolate sauce.
FALSE is a stack-based language with single-character commands and variables. For example, 3 + 1 can be calculated by evaluating (λ x → x + 1)(3):
INTERCAL, short for "Compiler Language With No Pronounceable Acronym".
LOLCODE is designed to resemble the speech of lolcats. The following is the "hello world" example:
HAI CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE
Malbolge (the 8th circle of Hell) was designed to be the most difficult and esoteric programming language.
One instruction set computer is a machine language with only one operation. This is actually a class of languages because one can define such a language for any given operation.
|Wikimedia Commons has media related to Piet (programming language).|
Piet is a language designed by David Morgan-Mar, whose programs are bitmaps that look like abstract art. The compilation is guided by a "pointer" that moves around the image, from one continuous coloured region to the next. Procedures are carried through when the pointer exits a region.
There are 20 colours for which behaviour is specified: 18 "colourful" colours, which are ordered by a 6-step hue cycle and a 3-step brightness cycle; and black and white which are not ordered. When exiting a "colourful" colour and entering another one, the performed procedure is determined by the number of steps of change in hue and brightness. Black cannot be entered; when the pointer tries to enter a black region, the rules of choosing the next block are changed instead. If all possible rules are tried, the program terminates. Regions outside the borders of the image are also treated as black. White does not perform operations, but allows the pointer to "pass through". The behaviour of colours other than the 20 specified is left to the compiler or interpreter.
Variables are stored in memory as signed integers in a single stack. Most specified procedures deal with operations on that stack, others with input/output and with the rules by which the compilation pointer moves.
Piet was named after the Dutch painter Piet Mondrian. The originally intended name, Mondrian, was already taken.
Shakespeare Programming Language (SPL) is designed to make programs look like Shakespearean plays. e.g. the following statement declares a point in the program which can be reached via a GOTO-type statement:
Act I: Hamlet's insults and flattery..
Whitespace uses only whitespace characters (space, tab, and return), ignoring all other characters. This is the reverse of many traditional languages, which do not distinguish between different whitespace characters, treating tab and space the same. It also allows Whitespace programs to be hidden in the source code of programs in languages like C.
||This article includes a list of references, but its sources remain unclear because it has insufficient inline citations. (February 2008)|
- McLean, A., Griffiths, D., Collins, N., and Wiggins, G. (2010). "Visualisation of Live Code". In Electronic Visualisation and the Arts, London: 2010.
- Woods, Donald R.; Lyon, James M. (1973), The INTERCAL Programming Language Reference Manual, Muppetlabs.com, archived from the original on 2009-04-24, retrieved 2009-04-24
- Turning tarpit - Esolang. Esolangs.org (2011-05-26). Retrieved on 2011-11-21.
- DM's Esoteric Programming Languages - Chef. Dangermouse.net. Retrieved on 2013-07-21.
- DM's Esoteric Programming Languages - Chef - Hello World. Dangermouse.net. Retrieved on 2013-07-21.
- Baking a Hello World Cake | Products of Mike's Mind. www.mike-worth.com. Retrieved on 2013-09-01.
- Morgan-Mar, David (25 January 2008). "Piet programming language". Retrieved 18 May 2013.
- Esolang — A wiki dedicated to esoteric programming languages.
- Esoteric Programming Language at WikiWikiWeb