BrainFuck

The BrainFuck programming language (originally by Urban Mueller) is beautifully minimalistic, elegant, very difficult to use and, of course, Turing complete. The language gives you a finite tape that can hold natural numbers, and a pointer. There are only eight commands:

> Moves the pointer one step right
< Moves the pointer one step left
+ Increments the current cell
- Decrements the current cell
[ If the current cell is zero, execution jumps to the matching "]"
] If the current cell is non-zero, execution jumps to the matching "["
. Prints the ASCII value of the current cell
, Inputs a character and fills the current cell with its ASCII value

I have included two extra commands based on the ones suggested by Blake Rhodes for numeric I/O.

: Prints the integer value of the current cell
; Inputs an integer and stores it in the current cell

Due to the commands, BrainFuck programs have a very simple flow structure, having no "goto" (or "come from") commands. Before you get worried however, rest assured that it is still practically impossible to understand a BF program from the source code.

The first thing you may think about this language is "How am I supposed to do anything in it?". The answer, you will be relieved to know, is "With great difficulty.". Don't despair, though, that is the whole point of the language.

[Part 2 of the tutorial >>>]

[ open the applet ]