Whitespace (programming language)
Encyclopedia
Whitespace is an esoteric programming language
Esoteric programming language
An esoteric programming language is a programming language designed as a test of the boundaries of computer programming language design, as a proof of concept, or as a joke...

 developed by Edwin Brady and Chris Morris at the University of Durham (also developers of the Kaya
Kaya (programming language)
Kaya is a programming language with a powerful type system, static type checking and type inference.- Overview :Kaya is a compiled language with a powerful and unobtrusive type system, allowing many bugs to be found at compile time...

 programming language). It was released on 1 April 2003 (April Fool's Day). Its name is a reference to whitespace characters
Whitespace (computer science)
In computer science, whitespace is any single character or series of characters that represents horizontal or vertical space in typography. When rendered, a whitespace character does not correspond to a visual mark, but typically does occupy an area on a page...

. 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. 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
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

, making the text a polyglot
Polyglot (computing)
In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it....

.

The language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 itself is an imperative
Imperative programming
In computer science, imperative programming is a programming paradigm that describes computation in terms of statements that change a program state...

 stack-based language. The virtual machine
Virtual machine
A virtual machine is a "completely isolated guest operating system installation within a normal host operating system". Modern virtual machines are implemented with either software emulation or hardware virtualization or both together.-VM Definitions:A virtual machine is a software...

 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.

History

Whitespace was created by Edwin Brady and Chris Morris in 2002. Slashdot
Slashdot
Slashdot is a technology-related news website owned by Geeknet, Inc. The site, which bills itself as "News for Nerds. Stuff that Matters", features user-submitted and ‑evaluated current affairs news stories about science- and technology-related topics. Each story has a comments section...

 gave a review of this programming language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

 on 1 April 2003. The same year an interpreter
Interpreter (computing)
In computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...

 for it was implemented in Whitespace.

The idea of using whitespace characters as operators for the C++
C++
C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...

 language was facetiously suggested five years earlier by Bjarne Stroustrup
Bjarne Stroustrup
Bjarne Stroustrup ; born December 30, 1950 in Århus, Denmark) is a Danish computer scientist, most notable for the creation and the development of the widely used C++ programming language...

.

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
Binary code
A binary code is a way of representing text or computer processor instructions by the use of the binary number system's two-binary digits 0 and 1. This is accomplished by assigning a bit string to each particular symbol or instruction...

 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

  • INTERCAL
    INTERCAL
    INTERCAL, a programming language parody, is an esoteric programming language that was created by Don Woods and James M. Lyon, two Princeton University students, in 1972. It satirizes aspects of the various programming languages at the time, as well as the proliferation of proposed language...

    , the "Compiler Language With No Pronounceable Acronym"
  • LOLCODE
    LOLCODE
    LOLCODE is an esoteric programming language inspired by the language expressed in examples of the lolcat Internet meme. The language was created in 2007 by Adam Lindsay, researcher at the Computing Department of Lancaster University....

    , a programming language patterned after a series of Internet meme
    Internet meme
    The term Internet meme is used to describe a concept that spreads via the Internet. The term is a reference to the concept of memes, although the latter concept refers to a much broader category of cultural information.-Description:...

    s.
  • Polyglot
    Polyglot (computing)
    In computing, a polyglot is a computer program or script written in a valid form of multiple programming languages, which performs the same operations or output independent of the programming language used to compile or interpret it....

    , a program valid in more than one language.
  • Steganography
    Steganography
    Steganography is the art and science of writing hidden messages in such a way that no one, apart from the sender and intended recipient, suspects the existence of the message, a form of security through obscurity...

  • Brainfuck
    Brainfuck
    The brainfuck programming language is an esoteric programming language noted for its extreme minimalism. It is a Turing tarpit, designed to challenge and amuse programmers, and is not suitable for practical use...

  • Malbolge
    Malbolge
    Malbolge is a public domain esoteric programming language invented by Ben Olmstead in 1998, named after the eighth circle of hell in Dante's Inferno, the Malebolge....


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK