💾 Archived View for kotan.srht.site › doc › brainfuck.gmi captured on 2024-05-12 at 15:03:12. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-11-04)

-=-=-=-=-=-=-

 ,    ,    /\   /\
/( /\ )\  _\ \_/ /_
|\_||_/| < \_   _/ >
\______/  \|0   0|/
  _\/_   _(_  ^  _)_
 ( () ) /`\|V"""V|/`\
   {}   \  \_____/  /
   ()   /\   )=(   /\
   {}  /  \_/\=/\_/  \

Brainfuck, an esoteric programming language.

Brainfuck is an esoteric programming language created in 1993 by Urban Müller.

Notable for its extreme minimalism, the language consists of only eight simple commands, a data pointer and an instruction pointer. While it is fully Turing complete, it is not intended for practical use, but to challenge and amuse programmers.

The language's name is a reference to the slang term brainfuck, which refers to things so complicated or unusual that they exceed the limits of one's understanding, as it was not meant or made for designing actual software but to challenge the boundaries of computer programming.

Language design.

The language consists of eight commands. A brainfuck program is a sequence of these commands, possibly interspersed with other characters (which are ignored). The commands are executed sequentially, with some exceptions: an instruction pointer begins at the first command, and each command it points to is executed, after which it normally moves forward to the next command. The program terminates when the instruction pointer moves past the last command.

The brainfuck language uses a simple machine model consisting of the program and instruction pointer, as well as a one-dimensional array of at least 30,000 byte cells initialized to zero; a movable data pointer (initialized to point to the leftmost byte of the array); and two streams of bytes for input and output (most often connected to a keyboard and a monitor respectively, and using the ASCII character encoding).

The eight language commands each consist of a single character:

Tricks.

To move or shift a value from one memory block to another:

+++++[>>+<<-]

To copy from one memory block to another:

+++++[>>+>+<<<-]>>>[<<<+>>>-]

Addition of 2 memory blocks:

+++++>+++[<+>-]

Subtraction of one block from another:

+++++++>+++++[<-

Multiplication:

+++[>+++++<-]

Home