Share on Facebook Share on Twitter Email
Answers.com

Whitespace

 
Wikipedia on Answers.com:

Whitespace (programming language)

Whitespace hello world program with syntax highlighting
  tabs
  spaces

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). It was released on 1 April 2003 (April Fool's Day). Its name is a reference to whitespace characters. Unlike most programming languages, which ignore or assign little meaning to most whitespace characters, the Whitespace interpreter ignores any non-whitespace characters. Only spaces, tabs and linefeeds have meaning.[1] An interesting consequence of this property is that a Whitespace program can easily be contained within the whitespace characters of a program written in another language, except possibly in languages which depend on spaces for syntax validity such as Python, making the text a polyglot.

The language itself is an imperative stack-based language. The virtual machine on which the 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) and can also access the heap as a permanent store for variables and data structures.

Contents

History

Whitespace was created by Edwin Brady and Chris Morris in 2002. Slashdot gave a review of this programming language on 1 April 2003.[2] The same year an interpreter for it was implemented in Whitespace.[citation needed]

The idea of using whitespace characters as operators for the C++ language was facetiously suggested five years earlier by Bjarne Stroustrup.[3]

Syntax

Commands are composed of sequences of spaces, tab stops and linefeeds. For example, tab-space-space-space adds the top two elements on the stack. Data is represented in binary using spaces (0) and tabs (1), followed by a linefeed, for example, space-space-space-tab-space-tab-tab-linefeed is the number 11. All other characters are ignored and thus can be used for comments.

Sample code

This prints "Hello World!". Note that whitespace characters have been given differently colored backgrounds and marked with separators since, in practice, they are invisible. ( Space ,  Tab )

this_is_a_Hello_World_program
| | | |
| | | |	| | |	| | | |
|	|	| | | | |	|
| | | |	|	| | |	| |	|
|	|	| | | | |	| |
| | | |	|	| |	|	| | |
|	|	| | | | |	|	|
| | | |	|	| |	|	| | |
|	|	| | | | |	| | |
| | | |	|	| |	|	|	|	|
|	|	| | | | |	| |	|
| | | |	| |	|	| | |
|	|	| | | | |	|	| |
| | | |	| | | | | |
|	|	| | | | |	|	|	|
| | | |	|	|	| |	|	|	|
|	|	| | |
| | |	| | | |
| | | |	|	| |	|	|	|	|
|	|	| | | | |	| | |	|
| | | |	|	|	| | |	| |
|	|	| | | | |	| |	| |
| | | |	|	| |	|	| | |
|	|	| | | | |	| |	|	|
| | | |	|	| | |
|	| | |
|	|	| | | | |	|	| | |
| | | |	| | | | |	|
|	|	| | | | |	|	| |	|
| | | |	|	| |	|
|	|	| | | | |	|	|	| |
| | | |	| |	| |
|	|	| | | | |	|	|	|	|
| | | | |
|	|
|	| | | | | |
empty-line
| | | | |	|
empty-line
| |	|	|	| |
empty-line
|	| | |	| |
|	|
| | | | | |	|
|	| | | |
empty-line
| | |	|
empty-line
| | | |	| |
empty-line
empty-line/EOF

See also

References

  1. ^ "Whitespace". http://compsoc.dur.ac.uk/whitespace/. 
  2. ^ "New Whitespace-Only Programming Language". Slashdot. April 1, 2003. http://developers.slashdot.org/story/03/04/01/0332202/New-Whitespace-Only-Programming-Language. 
  3. ^ Generalizing Overloading for C++2000. Bjarne Stroustrup.

External links


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
 
 
Related topics:
Python (computer jargon)
sitename (computer jargon)
White space

Related answers:
How do you remove the whitespaces above and below the list items that come when we create a UL in HTML? Read answer...

Help us answer these:
How does one prevent runaway whitespace when editing Answers?

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Wikipedia on Answers.com. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article Whitespace (programming language) Read more

Follow us
Facebook Twitter
YouTube

Mentioned in

» More» More