History
Whitespace was created by Edwin Brady and Chris Morris in 2002. Slashdot gave a review of this programming language on 1 April 2003. The idea of using whitespace characters as operators for the C++ language had been facetiously suggested five years earlier by Bjarne Stroustrup.Syntax
Commands are composed of sequences of spaces, tab stops and linefeeds. All other characters are ignored and thus can be used for comments. For example, tab-space-space-space performs arithmetic addition of the top two elements on the stack. Code is written as an ''Instruction Modification Parameter'' (IMP) followed by the operation. The table below shows a list of all the IMPs in Whitespace. Each IMP is followed by one operation defined for that IMP, and a parameter if needed. The list of operations supported in Whitespace is: The "copy" and "slide" operations were added in Whitespace 0.3 and may not be supported by all implementations.Numbers
Numbers are composed of spaces (0) and tabs (1), and they are terminated by a linefeed. The first space/tab in the number represents the sign of the number, if it's a space the number is positive, if it's a tab the number is negative. The rest of the trailing spaces and tabs represent the rest of the binary number.Examples
space-tab-space-space-tab-space-tab-tab-linefeed (STSSTSTTL) represents the binary number 1001011 (positive, because the number starts with a space) => 75 in decimal. tab-tab-tab-space-space-tab-space-linefeed (TTTSSTSL) represents the binary number 110010 (negative, because the number starts with a tab) => -50 in decimal.Labels
Labels are simply Fterminated lists of spaces and tabs. There is only one global namespace so all labels must be unique.Sample code
The following is a commented Whitespace program that simply prints "Hello, world!", where each Space, Tab, or Linefeed character is preceded by the identifying comment "S", "T", or "L", respectively: S S S T S S T S S S L:Push_+1001000=72='H'_onto_the_stack T L S S :Output_'H';_S S S T T S S T S T L:Push_+1100101=101='e'_onto_the_stack T L S S :Output_'e';_S S S T T S T T S S L:+1101100=108='l' T L S S S S S T T S T T S S L:+1101100=108='l' T L S S S S S T T S T T T T L:+1101111=111='o' T L S S S S S T S T T S S L:+101100=44=',' T L S S S S S T S S S S S L:+100000=32=Space T L S S S S S T T T S T T T L:+1110111=119='w' T L S S S S S T T S T T T T L:+1101111=111='o' T L S S S S S T T T S S T S L:+1110010=114='r' T L S S S S S T T S T T S S L:+1101100=108='l' T L S S S S S T T S S T S S L=+1100100=100='d' T L S S S S S T S S S S T L:+100001=33='!' T L S S :Output_'!';_L L L:End_the_program Note that when Whitespace source code is displayed in some browsers, the horizontal spacing produced by a tab character is not fixed, but depends on its location in the text relative to the next horizontal tab stop. Depending on the software, tab characters may also get replaced by the corresponding variable number of space characters.See also
* Polyglot, a program valid in more than one language * Steganography, the technique of concealing a message within another message * Off-side rule languages, where blocks are expressed by whitespace indentation ** Python, the best-known example of a language with syntactically significant whitespace * Esoteric programming languages ** Brainfuck, which consists of only eight simple commands and an instruction pointer ** INTERCAL, the "Compiler Language With No Pronounceable Acronym" ** LOLCODE, which is patterned after a series ofReferences
External links
*{{Official website, https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.php