#brainfuck #elf #optimization #compiler #linux #parser #x86-64 #x86 #batteries-included #done

app mindblown

Brainfuck to x86 ELF compiler with batteries included

8 unstable releases (3 breaking)

0.4.1 Sep 29, 2022
0.4.0 Sep 28, 2022
0.3.2 Sep 16, 2022
0.2.1 Sep 9, 2022
0.1.0 Sep 8, 2022

27 downloads per month

MIT and GPL-3.0-only

507 lines


Brainfuck to x86 ELF compiler with batteries included written in Rust meant for Linux and Windows under WSL. Code generation is made from brainf**k directly to x86 Intel assembly as IR. Most of the optimization work is done when parsing, so an integrated interpreter can benefit from it too.

This is in a very early state. Stay tuned for more features and optimizations like the ones described in TODO.

Note: samples/patterns.py was solely used for detecting common loop patterns in classical brainf**k programs for present and future refactoring.

Table of Contents


Getting started

Get the latest binary release installed on your machine

# Get the latest cargo release
$ cargo install mindblown

# Build from source
$ git clone https://github.com/Noxtal/mindblown.git
$ cd mindblown
$ cargo build --release


mindblown 0.4.0
Brainfuck to x86 ELF compiler with batteries included.

    mindblown [SUBCOMMAND]

    -h, --help       Print help information
    -V, --version    Print version information

    compile    Compiles a Brainfuck file.
    help       Print this message or the help of the given subcommand(s)

If no subcommand is provided, mindblown will default to the intergrated interpreter, which also uses the snailquote syntax for input. Please refer to their documentation for more information.

Compile a brainf**k program

Compiles a Brainfuck file.

    mindblown compile [OPTIONS] <FILE>

    <FILE>    The Brainfuck file to compile.

    -h, --help               Print help information
    -o, --output <OUTPUT>    The output file.
    -r, --run                Run the compiled executable after compiling.



  • Make the interpreter take in newlines
  • Add various CLI features such as choosing the output file, etc.
  • Implement clearer and smarter error handling
  • Optimize loop handling to Assembly
  • Allow for more optimization


~72K SLoC