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.
Tired of dealing with time constraints on algorithms in programming contests? How about memory constraints? Sign up for the contest here and join the select group of people who like making things unnecessarily complicated.
Original BrainF: only eight commands
The ++ part: functions!
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.
Main function
Execution always begins in the main function {mn}. Code outside of any function is ignored and does not execute.
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.
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.
{mn++(ab).}// Calls function "ab"
Global cells
Global cells are cells which are accessible to the left of the starting cell. They are static across all function calls.
The ab function decreases the global variable and returns 1 if it is positive, the mn function goes to the next cell as long as this value is positive. Overall, the program moves right the inputted number of times.
{mn<.>+[>(ab)]}
How to write "Hello World!"
>++.>+.+++++++..+++.>++.
<<+++++++++++++++.>.+++.------.--------.>+.>+.
Line by line explanations:
++++++++++ - Count to 10 (off to a great start!)
[>+++++++>++++++++++>+++<<<-] - The magic loop that sets up our ASCII values: 70 in cell 2, 100 in cell 3, and 30 in cell 4
>++. - Move to cell 2, add 2, output 72 = 'H'
>+. - Move to cell 3, add 1, output 101='e'
+++++++. - Add 7, output 108='l'
. - Output another 'l'
+++. - Add 3, output 111='o' (almost there!)
>++. - Move to cell 4, add 2, output 32=' '
...and the rest is just more ASCII arithmetic suffering 🌞
Live BrainF++ playground
Interpreter options
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.