BrainF++

The ridiculously minimalist programming language

BrainF++ is like programming with your hands tied behind your back... and blindfolded... while riding a unicycle. With only 8 commands, it's somehow Turing complete and can theoretically run anything your fancy modern languages can. It's the programming equivalent of making a gourmet meal with just a spoon.

Original BrainF: only eight commands

>
Move pointer right (baby steps)
<
Move pointer left (oops, went too far)
+
Increment cell value (counting up!)
-
Decrement cell value (counting down!)
.
Output cell value as ASCII (ta-da!)
,
Input ASCII to cell (feed me!)
[
Jump forward if cell is zero (maybe skip?)
]
Jump back if cell is non-zero (let's loop!)

The ++ part: functions!

Function system
BrainF++ supports the advanced, modern and forward-looking concept of functions for code organization and reuse.

Function declaration

Functions are declared with curly braces. The syntax is {mn code here} where the two-letter function name immediately follows the opening brace.

{ab}+++.}// Function named "ab"

Main function

Execution always begins in the main function {mn}. Code outside of any function is ignored and does not execute.

{mn}+++.}// Main function - this runs

Function calls

To call a function, use parentheses with the two-letter function name: (ab). The current cell value is passed as input, and the return value replaces the current cell.

{ab}+++;}
{mn}++(ab).}// Calls function "ab"

Return values

Use the semicolon ; command to return a value from a function. The current cell value is returned and replaces the cell value at the call site.

{ab}++++++;}// Returns 6

How to write "Hello World!"

Your first masterpiece
This program outputs "Hello World!" and will make you question your life choices
++++++++++[>+++++++>++++++++++>+++>+<<<<-]
>++.>+.+++++++..+++.>++.
<<+++++++++++++++.>.>+.+++.------.--------.>+.>+.

What's happening here? (Spoiler: it's complicated)

++++++++++ - Count to 10 (we're off to a great start!)

[>+++++++>++++++++++>+++>+<<<<-] - The magic loop that sets up our ASCII values (don't ask how long this took to figure out)

>++. - Move right, add 2, output 'H' (we did it!)

>+. - Move right, add 1, output 'e' (getting the hang of this)

+++++++. - Add 7, output 'l' (math is hard)

. - Output another 'l' (copy-paste doesn't exist here)

+++. - Add 3, output 'o' (almost there!)

...and the rest is just more ASCII arithmetic wizardry ✨

The secret sauce: We're basically doing manual ASCII math because apparently using a string literal is for weaklings. Each character requires calculating its exact ASCII value through addition and subtraction. It's like solving a puzzle where the reward is... well, "Hello World!"

Live BrainF++ playground

Playground
Write and run BrainF++ code. Warning: may cause existential crisis
Run your code to see output here...

Join the madness: BrainF++ contest

Think you've mastered the art of programming with 8 commands? Put your skills to the test in our monthly BrainF++ coding contests! Compete against fellow masochists... err, enthusiasts... to solve algorithmic challenges using nothing but the magnificent eight. Warning: side effects may include questioning your career choices and an inexplicable urge to write everything in BrainF++.

The origin story

Back in 1993, Urban Müller looked at programming languages and thought "You know what? These have way too many features." So he created BrainF++, a language so minimal it makes assembly look verbose. It's proof that you can make programmers cry with just 8 characters. Despite being designed as a challenge to create the smallest possible compiler, it accidentally became a rite of passage for masochistic programmers everywhere. 🧠💀