Content deleted Content added
Add copy and swap operations from |
Replace Whitespace 0.2 tutorial links with 0.3 link; mention wspace/corpus |
||
Line 2:
[[File:Whitespace in vim2.png|right|206px|thumb|Whitespace [[hello world program]] with syntax highlighting {{legend|#0000ab|tabs}} {{legend|#ab0000|spaces}}]] <!-- make SVG file -->
'''Whitespace''' is an [[esoteric programming language]] developed by Edwin Brady and Chris Morris at the [[University of Durham]] (also developers of the [[Kaya (programming language)|Kaya]] and [[Idris (programming language)|Idris]] programming languages). It was released on 1 April 2003 ([[April Fool's Day]]). Its name is a reference to [[whitespace character]]s. Unlike most programming languages, which ignore or assign little meaning to most whitespace characters, the Whitespace interpreter ignores any non-whitespace characters. Only [[Space character|spaces]], [[Tab character|tabs]] and [[linefeed]]s have meaning.<ref name="whitespace">{{cite web|url=http://compsoc.dur.ac.uk/whitespace/tutorial.php|title=Whitespace|website=Compsoc|access-date=2015-
The [[programming language|language]] itself is an [[imperative programming|imperative]] [[stack-based language]]. The [[virtual machine]] on which the programs run has a stack and a [[dynamic memory allocation|heap]]. The programmer is free to push arbitrary-width integers onto the stack (currently there is no implementation of floating point numbers) and can also access the heap as a permanent store for variables and [[data structure]]s.
Line 15:
Data is represented in [[Binary code|binary]] using spaces (0) and tabs (1), followed by a linefeed; thus, space-space-space-tab-space-tab-tab-linefeed is the binary number 0001011, which is 11 in decimal. All other characters are ignored and thus can be used for comments.
Code is written as an ''Instruction Modification Parameter'' (IMP) followed by the operation.<ref name="
{| class="wikitable"
|-
Line 31:
|}
Each IMP is followed by one operation defined for that IMP, and a parameter if needed. The list of operations supported in Whitespace is:<ref name="
{| class="wikitable"
Line 85:
| [Tab][LF] || [Tab][Tab] || - || Read a number and place it in the ___location given by the top of the stack
|}
The "copy" and "slide" operations were added in Whitespace 0.3 and may not be supported by all implementations.<ref name="whitespace"/>
==Sample code==
Line 108 ⟶ 110:
==External links==
*{{Official website|https://web.archive.org/web/20150618184706/http://compsoc.dur.ac.uk/whitespace/tutorial.
*[http://developers.slashdot.org/article.pl?sid=03/04/01/0332202 Release announcement on Slashdot]
*[https://github.com/wspace/corpus The Whitespace Corpus] A collection of interpreters, compilers, and programs for Whitespace
*[https://github.com/hostilefork/whitespacers/ Collection of Whitespace interpreters in various script languages]
*[http://metacpan.org/module/Acme::Bleach Acme::Bleach] A [[Perl]] module that rewrites the body of your module to a whitespace-only encoding ("for ''really'' clean programs").
|