Programming in Brainfuck


Tired of programming languages whose goal it is to make your life easier? Feel like stretching the 'ol grey matter a bit? Why not try coding in Brainfuck!

"Did you say Brainfuck?"

Yup, that's what I said, Brainfuck.

Created by Urban Mueller, Brainfuck is an eight instruction Turing-complete programming language. This means that it can be shown to be equivalent to a Turing machine and therefore capable of performing any computation. (Click here for a Google search on Turing machine.)

"Why would someone create a language with only eight instructions?"

Urban's goal, it seems, was to create a very small compiler and to do that it helps to have a very small language. Urban succeded on both counts, writing a compiler for the Amiga OS ver 2.0 which was only 240 bytes long.

"OK, so tell me about this language."

Brainfuck has no variables, no functions, no conditionals, ... none of the usual constructs we all take for granted in programming languages.

"Now that I know what it doesn't provide, how's about cluing me in on what it does provide?"

OK, here's what you've got:

That's it ... Short, sweet and to the point.

The instructions all are single characters and are as follows:

Brainfuck is a more or less block structured, gotoless programming language. Through the use of the looping construct ([ some code ]), conditionals can be implemented. A value of zero (logical false) will cause the loop to be skipped while a value of one (logical true) will cause the loop to execute. This is what an if statement does anyway.

"And with this I'm supposed to write meaningful code?"

Brainfuck provides everything you need to program (like I said above, it is Turing-complete). As for the meaningful part ... well, that all up to you now, isn't it?

"So... Um... Do 'ya think you can get me started?"

OK. Click here to see our first program.

Home | Introduction | First Program | Input Processing | Building Blocks | Resources | bf2pl

cydathria dot com