A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Whitespace page! Here, you'll find a description of the language as well as a list of sample programs in that language.
This article was written by:
According to Wikipedia, Whitespace is an esoteric language developed by Edwin Brady and Chris Morris in 2002 at the University of Durham. According to the Esolang Wiki, a post to Slashdot about the language was done on April 1, 2003. Most people assumed it was a joke. However, it was not.
Unlike other languages where whitespace characters are either ignored or used as a separator between tokens, Whitespace uses these characters as instructions. All instructions are made up of 3 whitespace characters:
Everything else is ignored, so non-whitespace characters can be used as comments or to annotate the program. A common practice is to add a letter indicating the whitespace character before that character:
S
for spaceT
for tabL
for linefeedFor example, here is the code to output the letter H
:
S S S T S S T S S S L
T L
T L
S S
Wikipedia indicates that Whitespace is an imperative, stack-based language. It also has a "heap", which is actually just memory storage to an arbitrary address. There are instructions for the following:
Numbers are of arbitrary length and are represented like this:
0
) for positive, tab (1
) for negative0
, tab for 1
For example, 100
(110 0100
) would be represented as this:
sign | 1 | 1 | 0 | 0 | 1 | 0 | 0 | term |
---|---|---|---|---|---|---|---|---|
space | tab | tab | space | space | tab | space | space | linefeed |
For further information on the Whitespace language, see the official tutorial. Since creating a Whitespace program is very tedious, you can use a Whitespace assembler instead.
There are 4 articles: