What is Whitespace?

Whitespace is a programming language that only uses spaces, linefeeds, and tabs – the interpreter ignores all other characters. Each command in the Whitespace language consists of a series of tokens.

Stack-based languages work using a global stack. The functions push and pop values onto this global stack in order to perform various operations.

Syntax

In Whitespace, values are represented by the number of consecutive spaces, and actions are represented by the number of consecutive characters. Different commands have different Instruction Modifier Parameters (IMPs), which are proceeded by their commands and parameters.

Whitespace represents data in a binary formusing spaces for 0 and tabs for 1 followed by a linefeed. For example the sequence, [space][space][tab][tab][tab][space][linefeed] represents the binary number 001110, which is 1414 in decimal.

Similarly, arithmetic commands have a unique representation in Whitespace. For example, [space][space] represents the addition operation, while [space][tab] represents subtraction.


Free Resources