Brainfuck

Aus ProgrammingWiki

Wiki-Quelltext dieser Seite.

<language>FLACI_</language>
Die Programmiersprache Brainfuck ist keine ernsthafte Programmiersprache, sie gilt aber mit ihren wenigen Befehlen dennoch als Turing-complete und kann damit theoretisch alles berechnen, was mit anderen Programmiersprachen auch möglich ist.

Brainfuck kennt die folgenden 8 Befehle:
<pre>
> = increases memory pointer, or moves the pointer to the right 1 block.
< = decreases memory pointer, or moves the pointer to the left 1 block.
+ = increases value stored at the block pointed to by the memory pointer
- = decreases value stored at the block pointed to by the memory pointer
[ = like c while(cur_block_value != 0) loop.
] = if block currently pointed to's value is not zero, jump back to [
, = like c getchar(). input 1 character.
. = like c putchar(). print 1 character to the console
</pre>

Hier ein Hallo World! Programm in Brainfuck:

<run id="5db1736d87d73">
>+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]
>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++
.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.
</run>