Whitespace (programming language)
From Wikipedia, the free encyclopedia
Whitespace is an esoteric programming language developed by Edwin Brady and Chris Morris at the University of Durham. It was released on 1 April 2003 (April Fool's Day). Contrary to most languages, which often ignore most whitespace characters, the Whitespace interpreter ignores any non-whitespace characters. Only spaces, tabs and newlines are considered syntax. An interesting consequence of this property is that a Whitespace program can easily be contained within the whitespace characters of another language, making the same code a polyglot.
The language itself is an imperative stack-based language. The virtual machine on which programs run has a stack and a heap. The programmer is free to push arbitrary width integers onto the stack (currently there is no implementation of floating point numbers). The user can also access the heap as a permanent store for variables and data structures.
Whitespace is jokingly called a great language for secretive programs because important code can be printed onto plain sheets of white paper and stored safely without worry of discovery by inspection (or of ever being recovered by anyone, including the intended recipient).
Whitespace has been proven Turing-complete,[1] by an obscure post in the homepage mailing list archive, though the proof is yet to be reviewed.
Contents |
[edit] History
Whitespace was created by Edwin Brady and Chris Morris in 2002. Slashdot gave a review of this programming language on April, 1st 2003. The same year an interpreter for it was implemented in whitespace. The idea for this language was already mentioned five years earlier by Bjarne Stroustrup.
[edit] Syntax
Commands only consist of spaces, tab stops and linefeeds. Data is represented binary with tab stops and line breaks. All other characters are ignored and thus can be used for comments.
[edit] Sample code
This prints "Hello World!". Note that whitespace has been highlighted (Space, Tab)
empty-line empty-line empty-line empty-line empty-line empty-line empty-line/EOF
[edit] See also
- Brainfuck, another esoteric computer programming language that, similarly to Whitespace, ignores anything it doesn't recognize.
- Apollo, a variant of Brainfuck that combines whitespace-based syntax with Brainfuck's complex semantics.
- Polyglot, a program valid in more than one language.
- Steganography
- lolcode
[edit] References
- ^ Proof of Whitespace Turing-completeness URL accessed July 13, 2007.
[edit] External links
- Whitespace homepage
- Release announcement on Slashdot
- Acme::Bleach A Perl module that rewrites the body of your module to a whitespace-only encoding ("for really clean programs").