Description #
Brain-Flak is a stack-based esoteric programming language designed for minimalism, code-golf challenges, and syntactic weirdness. It uses only parentheses and brackets for operations.
History #
Brain-Flak was created in 2015 by William Hicks and Patrick Manson. It was submitted as part of an esolang competition on esolangs.org, aiming to blend stack-based computation with novelty syntax. Its peculiar design involves manipulating two stacks using sequences of brackets and parentheses.
Hello World Code #
(()()()()){{}}(())
How to Run #
Option 1: Online
https://tio.run/
(Select “Brain-Flak” from the language dropdown)
Option 2: Local
- Install Python 3
- Clone the GitHub interpreter
- Run:
python3 brainflak.py yourfile.bf
Key Concepts #
- Minimal syntax: Uses only
()
,[]
,{}
, and<>
. - Two stacks: Programs operate between a left and right stack.
- Bracket-based operations: Each bracket type performs specific stack actions.
- Integer evaluation: Bracket blocks evaluate to integers.
- Looping via recursion: You loop using nesting and stack manipulation.
- Code-golf friendly: Great for writing short, cryptic programs.
- No traditional keywords: All logic is represented through structure.
- Output requires creativity: Printing and logic must be structured with stack pushes/pops.
- Esoteric challenge: Designed to be intentionally difficult.
- Community-driven extensions: Variants and extensions exist on esolang wikis.
Try It Online #
Fun Facts #
- The Hello World code is deceptively short but relies on deep stack manipulations.
- Brain-Flak programs look like artful patterns of brackets rather than conventional code.
- Some community members have created visualizers to make debugging easier.
- It’s one of the few esolangs built specifically around dual stacks.