Brainfuck

From Simple English Wikipedia, the free encyclopedia

The brainfuck programming language is an esoteric (weird and unusual) programming language. It was created by Urban Müller in 1993.[1][2] It has eight instructions (commands) which operate (do things on) a tape.[1] Instructions are done one by one, in order.[1] The tape has multiple sections.[1] Each section is a number.[1][2] Each section is, in the beginning, zero.[1] Brainfuck is like a Turing machine. [1]

Instruction table[change | change source]

Instruction Action
+ Add one to the current tape section.
- Subtract one from the current tape section.
< Move to the tape section to the left of the current one.
> Move to the tape section to the right of the current one.
. Print the value of the current tape section as an ASCII symbol.
, Read an ASCII symbol into the current tape section as a number.
[ If the current tape section is zero, go to the matching ], skipping the instructions in between.
] If the current tape section is not zero, go back to the matching [, and do the code after it again.

Examples[change | change source]

[-]

If the current section is not zero, these three commands subtract one until the current section is zero. Otherwise, they leave it at zero.

+++--

These five commands first add three to the current section. Then, they subtract two from the current section. Since , these five commands are the same as "+" alone.

Derivatives[change | change source]

As a result of brainfuck's fame, many derivatives (versions) of brainfuck have been created. These include Brain-Flak,[3] pbrain,[4] and tinyBF.[5] Most are also Turing complete, just like brainfuck.


References[change | change source]

  1. 1.0 1.1 1.2 1.3 1.4 1.5 1.6 "brainfuck - Esolang". esolangs.org. Retrieved 2022-04-23.
  2. 2.0 2.1 262588213843476. "Basics of BrainFuck". Gist. Retrieved 2022-04-23. {{cite web}}: |last= has numeric name (help)
  3. "Brain-Flak - Esolang". esolangs.org. Retrieved 2022-04-24.
  4. "pbrain - Esolang". esolangs.org. Retrieved 2022-04-24.
  5. "tinyBF - Esolang". esolangs.org. Retrieved 2022-04-24.