| | {{infobox |
| | | title = Brainfuck |
| | | designer = Urban Müller |
| | | first appeared = 1993 — Amiga |
| | | paradigm = esoteric · imperative · Turing-complete |
| | | typing = bytes on a tape — there is nothing else |
| | | filename extensions = .b · .bf |
| | | influenced by = the challenge of minimum possible language size |
| | | influenced = hundreds of derivatives — Ook! · Boolfuck and beyond |
| | }} |
| | |
| | # Brainfuck |
| | |
| | **Brainfuck** is the smallest famous programming language in the world, and the name is a warning, not a boast. Urban Müller wrote it in 1993 for the Amiga, driven by a single ambition: to design a language whose compiler could be made as small as possible. The result was a compiler of roughly 240 bytes — an executable that fits inside a single tweet — and a language with exactly **eight commands**, no syntax, no types, no variables, and no mercy.[[cite: [Brainfuck](https://esolangs.org/wiki/Brainfuck), esoteric-languages wiki — Müller's Amiga origin, the 240-byte compiler claim, and the canonical command set]] |
| | |
| | The name comes from the experience of writing it. Müller's distribution file, released through the Amiga shareware network **Aminet**, noted that the language was designed to be frustrating — programs are so difficult to write that they feel like a violation. It is, in other words, a language where the difficulty *is* the spec.[[cite: Urban Müller's original Amiga distribution, archived at [Aminet](https://aminet.net/package/dev/lang/brainfuck-2) — the 1993 release notes and bundled compiler]] |
| | |
| | # Eight commands and nothing else |
| | |
| | Brainfuck programs run on a tape — conventionally **30,000 cells** of byte-sized memory in Müller's original, though implementations vary — with a single data pointer that starts at cell zero. The entire language is: |
| | |
| | | Command | Meaning | |
| | |---|---| |
| | | `>` | move the data pointer one cell right | |
| | | `<` | move the data pointer one cell left | |
| | | `+` | increment the byte at the pointer | |
| | | `-` | decrement the byte at the pointer | |
| | | `.` | output the byte at the pointer as a character | |
| | | `,` | input a character into the byte at the pointer | |
| | | `[` | jump forward past the matching `]` if the current byte is zero | |
| | | `]` | jump back to the matching `[` if the current byte is nonzero | |
| | |
| | That is the entire language. Eight characters, and the machine is **Turing-complete** — the eight commands are sufficient to simulate any computable function, which is simultaneously the language's entire point and its entire cruelty. Hello, World looks like this: |
| | |
| | ``` |
| | ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. |
| | ``` |
| | |
| | That is *the* canonical Brainfuck "Hello, World!" — a program which, read aloud, is just punctuation, and which executes perfectly.[[cite: [Hello World program in esoteric languages](https://esolangs.org/wiki/Hello_world_program_in_esoteric_languages) — canonical Brainfuck example]] |
| | |
| | # The smallest joke that could still be a language |
| | |
| | Müller's achievement was not only that the language is small — it is that it is *complete*. In 1993 the idea that a Turing-complete machine needed only eight operations was still a provocation, and the size of Müller's compiler made the point physically: **the whole implementation could be memorized**. The program is smaller than most programs' copyright headers. When a Brainfuck interpreter is described as trivial to write, that is accurate — writing one is now the canonical first exercise in any language's tutorial, which is itself a kind of joke. The language invented to be nearly unusable became the most-ported language in existence. |
| | |
| | ```fact |
| | Brainfuck's tape has no allocated memory to speak of — cells are just bytes — and the machine has **no program counter separate from its data pointer**. The two mechanisms (code and data) are fused into one stream of source, which is why the language is both a parser and a memory model at once. |
| | ``` |
| | |
| | # A family of hundreds |
| | |
| - | The most remarkable thing about Brainfuck is not what it is but what it started. Müller's reduction — language as a minimal machine — became a *challenge*, and the esolang community spent the next decades answering it. [[INTERCAL]] had proven a language could be a joke; Brainfuck proved the joke could be *minimal*. The result was hundreds of derivatives archived at the esoteric-languages wiki — most famously **Ook!**, which translates Brainfuck into orangutan vocalizations (`Ook. Ook?` for `.` and `,`), and **Boolfuck**, which runs on single bits instead of bytes. The genre's catalogue is a taxonomy of absurdity, and every branch traces back to Müller's eight characters.[[cite: [Brainfuck derivatives](https://esolangs.org/wiki/Category:Brainfuck_derivatives) — the community-archived family tree]] |
| + | The most remarkable thing about Brainfuck is not what it is but what it started. Müller's reduction — language as a minimal machine — became a *challenge*, and the esolang community spent the next decades answering it. [[INTERCAL]] had proven a language could be a joke; Brainfuck proved the joke could be *minimal*. The result was hundreds of derivatives archived at the esoteric-languages wiki — most famously **Ook!**, which translates Brainfuck into orangutan vocalizations (`Ook. Ook.` is `+`, `Ook! Ook.` is `.`, `Ook. Ook!` is `,`), and **Boolfuck**, which runs on single bits instead of bytes. The genre's catalogue is a taxonomy of absurdity, and every branch traces back to Müller's eight characters.[[cite: [Brainfuck derivatives](https://esolangs.org/wiki/Category:Brainfuck_derivatives) — the community-archived family tree]] |
| | |
| | Later still, Brainfuck got an actual hardware implementation — a **Brainfuck CPU** — and its programs were found running in cryptography challenges, demoscene productions, and compiler pedagogy where it remains the standard "write an interpreter" exercise for language courses. The joke has become infrastructure. |
| | |
| | # What it taught us |
| | |
| | Brainfuck is not a programming language so much as a *proof* — that a computer needs nothing more than memory, motion, increment, decrement, I/O, and a loop. It is the smallest possible answer to the question *what must a language contain*, and its answer is: **almost nothing**. The reason programmers keep returning to it is not that it is useful; it is that it is *pure* — a machine with nothing left to remove, and therefore, perversely, the ideal object for studying what a machine *is*. |
| | |
| | ## Check your understanding |
| | |
| | - [ ] How many commands does Brainfuck have — and can you name them? |
| | - [ ] What is the data pointer, and why is there no program counter separate from it? |
| | - [ ] What does "Turing-complete" mean in the context of an 8-command language? |
| | - [ ] Why did Müller name it "Brainfuck"? |
| | |
| | ```hide Show answers |
| | 1 — **eight** commands: `>`, `<`, `+`, `-`, `.`, `,`, `[`, `]` — the entire language. |
| | 2 — the data pointer selects which tape cell the next `+`/`-`/`.`/`,` acts on; the program counter simply steps through source characters, fused with the data stream. |
| | 3 — it means the language can compute anything any Turing machine can — completeness despite only eight commands, which is the point. |
| | 4 — the name is honest: programs are deliberately painful to write, and Müller documented that the difficulty was the design goal. |
| | ``` |
| | |
| | [[Category:Languages]] |
| | [[Category:Esoteric languages]] |
| | [[Category:Programming]] |
| | [[Category:History]] |
| | |