Brainfuck is a minimal language consisting of only eight instructions, a pointer and an array of bytes. At the start of a brainfuck program, the pointer is referencing the first byte of the array. The instructions are all one character long, and the whole set looks like this:

>

Increment the pointer.

<

Decrement the pointer.

+

Increment the byte at the pointer.

-

Decrement the byte.

.

Output the byte.

,

Input a byte and store it at the pointer.

[

If the byte is 0, jump past the matching ]

]

Jump to the matching [

All other characters should be discarded by the interpreter/compiler. That's brainfuck. The mandatory "hello world" program could look like this, for example:

h ++++++++[>+++++++++++++<-]>.
e ---.
l +++++++.
l .
o +++.
 >+++++[<+++++++++>-]<++++.
w >++++[<---------->-]<-.
o --------.
r +++.
l ------.
d --------.
! >+++[>+++++++++++<-]>.

The Brainfuck Archive


CategoryLanguage

BrainFuckLanguage (last edited 2008-07-09 05:47:57 by localhost)