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.


New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources