Spaces and tabs
Brainfuck you cannot see. Every command is three blanks, and only the word end is visible.
2023 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
Spaces and tabs is brainfuck written in the two characters a page shows as nothing. Each of brainfuck's eight commands becomes a group of three, and two kinds of blank in three places make exactly eight groups. The program ends at the word end, the only thing on the line you can read.
The machine
| Group | brainfuck |
|---|---|
| space space space | > |
| space tab space | < |
| tab space space | + |
| tab space tab | - |
| tab tab space | . |
| tab tab tab | , |
| space space tab | [ |
| space tab tab | ] |
end | The end of the program |
Cells hold 0 to 255 and wrap around, and the tape runs both ways. The end of the input reads as 0. The original interpreter is in Common Lisp and not in the specification, so these are this implementation's choices.
Example
The Hello World is 78 groups, the brainfuck program --<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++.
The Hello World is 78 groups, the brainfuck program --<-<<+[+[<+>--->->->-<<<]>]<<--.<++++++. and so on. It needs cells that wrap and a tape that goes left of where it starts, and it takes 473,214 steps.
The truth machine is >>>,.[[->+<<+>]>-]<<<[<<]>[.]. It prints the digit it reads, then spreads the character code down the tape one less each time and checks whether it was odd. On 0 it stops, and on 1 it prints 1 forever.
The cat is +[,.], which prints every byte up to and including the first 0.
Patterns it teaches
- Camouflage: a program that looks like an empty line.
- Encoding tricks: eight commands in three binary digits.
- Turing tarpit: brainfuck underneath.
See also
Spaces and tabs builds on Brainfuck.
Brainfuck derivatives
Write your own in Run Convert a program from Spaces and tabs
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: spaces-and-tabs.
Command line
shib run spaces-and-tabs -e ' end' --input 'cat '