Whitespace
Whitespace
Whitespace is a programming language in which the only meaningful characters are the ones you cannot see: space, tab, and linefeed. Everything else — every letter, digit, and punctuation mark — is ignored by the interpreter and functions purely as a comment. Designed by Edwin Brady and Chris Morris and released in 2003, it takes the one convention every other language shares — that whitespace is insignificant — and inverts it with total commitment.[1]
The timing deserves note: Whitespace appeared on Slashdot on April 1st, 2003, and most readers dismissed it as an April Fool's joke. It wasn't. The implementation was real, the specification was complete, and the language genuinely works — the prank was making a real thing look like a joke rather than the other way around.[2]
An alphabet of nothing
The entire syntax of Whitespace is built from three tokens. Numbers are written as a sign — space for positive, tab for negative — followed by a binary magnitude in which space is 0 and tab is 1, terminated by a linefeed. Commands begin with an IMP — an Instruction Modification Parameter — that selects the category of operation:
| IMP | Category |
|---|---|
space | stack manipulation |
tab space | arithmetic |
tab tab | heap access |
linefeed | flow control |
tab linefeed | I/O |
Inside those categories, the language is a fairly conventional stack machine: push a number, duplicate/swap/discard the top of stack, add/subtract/multiply/divide/mod the top two cells, store and load from a heap by address, mark labels and jump or call on conditions, read and write characters and numbers. The alien part is purely the notation — underneath the invisible surface, Whitespace is a working imperative language with arithmetic, memory, subroutines, and I/O.[3]
The invisible program
The party trick that made Whitespace famous is a consequence of its alphabet: a Whitespace program can hide inside another program's whitespace. A file that looks like an ordinary C or Python source — or a memo, or a poem — can simultaneously be a complete Whitespace program, since every visible character is simply discarded. The canonical demonstration is a Whitespace program embedded in the indentation of a normal program: two languages sharing one file, one of them completely invisible.[4]
Debugging is correspondingly special. Every conventional tool — grep, diff, your editor's display — treats the source as blank space, so the Whitespace community quickly produced syntax-highlighting renderings (the ␠ ␉ ␊ symbols now standard in documentation) just to see the programs they had written. It is the only language in this catalogue for which "show invisible characters" is a prerequisite for code review.
Where it sits in the wing
If INTERCAL proved a language could be a parody, Brainfuck proved it could be minimal, and Malbolge proved it could be hostile, Whitespace proved it could be invisible — a fourth and distinct axis of perversity. It answers a question no one needed answered: what if the only thing that mattered was the part every compiler throws away? The answer turns out to be: a perfectly serviceable stack machine hiding in the margins of your code.
It also gave the world the purest Hello World ever shipped — a file that prints a greeting while containing, by any visible measure, literally nothing.
Check your understanding
- Which three characters carry meaning in Whitespace — and what is every other character?
- How is a negative number written?
- What is an IMP, and name two of the five categories?
- Why was Whitespace's April 1st release date ironically unfortunate?
Show answers
1 — space, tab, and linefeed are syntax; everything else is ignored and serves as a comment. 2 — a tab sign bit followed by the magnitude in binary (space=0, tab=1) ended by a linefeed. 3 — an Instruction Modification Parameter — the command prefix selecting the category: stack, arithmetic, heap, flow control, or I/O. 4 — it hit Slashdot on April Fool's Day 2003, so most readers assumed it was a joke — it wasn't, and the implementation was completely real.
Footnotes
- ↑ Whitespace, esoteric-languages wiki — Brady & Morris, the three-token alphabet, and the non-joke release date
- ↑ Whitespace — the April 1, 2003 Slashdot posting and its reception
- ↑ Whitespace command reference — the IMP categories and the full instruction set
- ↑ Whitespace — the polyglot/embedding consequence of ignoring all non-whitespace