Wierd programming language
From Free net encyclopedia
The Wierd programming language, conceived by Chris Pressey, is an esoteric programming language that is inspired by the small instruction set of Brainfuck and the spatial aspect of Befunge. While Brainfuck uses eight simple instructions to create a Turing-complete but difficult to use language, Wierd encodes its instructions as angles in a line. A program is represented by a long line with many bends in it, drawn using ASCII art. It is believed to be Turing complete.
Despite that Wierd is essentially a convoluted way of encoding seven instructions, the spatial representation leads to some unique programming challenges. Often, Wierd programmers desire to write a program that does not intersect itself, leading to constraints on the instructions that are available at certain times.
Although it is a common misspelling of the English word "weird", the name of the programming language is correctly spelled "Wierd", as declared by its creators.
Contents |
Instructions
The possible instructions are angles that are multiples of 45 degrees, as follows:<ref>This description of the instruction set comes from Wierd's page on the Esolang Wiki, which is in the public domain.</ref>
0 degrees NO: No operation, continue as normal. 45 degrees P1: Push a data value of 1 onto the stack. 90 degrees IF: Pop the stack. If the value is zero, continue executing as normal. If the value is nonzero, however, reverse direction. 135 degrees GP: Pop the stack. If the value is zero, pops the next two items from the stack, retrieves (gets) the value stored at the coordinates specified by these values (x, then y), and push it onto the stack. If the first value was nonzero, however, takes the value stored below the coordinates on the stack, and stores (puts) it at the coordinates. 180 degrees QU: Jump the gap, if possible. Otherwise, terminate. 225 degrees IO: Pop the stack. If the value is zero, read a character from input, pushing it onto the stack. If the value was nonzero, pop the stack, and print the value to output as a character. 270 degrees IF: See 90 degrees. Included for flexibility. 315 degrees SB: Subtract the top of the stack from the value beneath it, popping both values, and pushing the result.
Additionally, a T-shape -- that is, a simultaneous 90- and 270-degree angle -- splits the instruction pointer in two; this could be considered a very primitive form of threading.
Example
This small Wierd program by Milo van Handel takes its input and copies it to its output:<ref>http://catseye.mine.nu:8080/projects/wierd/eg/</ref>
* ****** * * * * * * * * * * * *** * ** * * * * * * * * * * *** ** *
See also
References
<references/>