Brainfuck - tiny programming language

If Jason Statham was a programming language - he'd be this one Tonight I found out about an awesome little something called "brainfuck". It's a tiny programming language created by a guy called Urban Müller and it was designed to be used in the worlds smallest compiler (less than 200 bytes!). With 8 operators and nothing else it looks like it's from another planet.

Operators:
> - increment memory pointer
< - decrement memory pointer
+ - increment memory value
- - decrement memory value
. - output memory byte
, - input memory byte
[ - begin loop, while (byte != 0)
] - end loop

Since brainfuck is turing complete -- with just these operators you can acheive quite a bit, but after about 20 minutes I realised how the language acquired it's name. It's crazy but a lot of fun, I ended up coding this:
++++>++++>++++[<[<++++>-]++++>-]<<.>++[<++++++>-]<+.>+++[<+++>-]<.++.+++++.>++>++[<[<----------->-]++>-]<<.>+++++[<+++++>-]<-.-.---.------.>++>++[<[<+++++>-]++>-]<<.>++[>++++++<-]>-[>++<-]>.<++[<<----------->>-]<<.>++++++[<++>-]<.>>>.<<<++++++.>++[<----->-]<.
All it does is output this to the screen, but it does it with only 3 bytes of RAM. DirtyMonkey.co.uk
Another thing I done was this, a caesar ciper with a shift of 3 (ie. A changes to D): [-]>,----------[>,----------]>[-]<<[<]+[>+++++++++++++.-------------]
For a great guide check out the Tutorial in Brainfuck Programming by omin0us.

Give it a blast!

jump to top