Back

project

BrainFudger

A Brainf*ck compiler that generates real native binaries — eight targets, no compromises.

Runs on Windows macOS
C# ELF PE Mach-O MS-DOS .NET

BrainFudger is a compiler for Brainf*ck — one of the most famous esoteric programming languages — that takes the job seriously. It doesn't interpret. It doesn't transpile to C and call a compiler. It reads your .bf source, validates the bracket structure, and writes out a genuine native binary for your target platform: ELF, PE, Mach-O, or MS-DOS, entirely from scratch.

The compiler ships eight binary backends, covering x64, x86, and ARM64 across Linux, Windows, macOS, and MS-DOS. Each backend hand-crafts the binary format — no linker, no libc, no external dependencies. The Linux targets emit static syscall-only ELF executables. The MS-DOS targets emit real 16-bit code that runs on DOS 5.0+, DOSBox, or actual vintage hardware.

It comes with native GUI hosts on each desktop platform — a Win32 app on Windows, an AppKit app on macOS, and a native desktop host on Linux — alongside the CLI. Both surfaces share the same compiler core.

BrainFudger native Win32 GUI on Windows
Win32 GUI — Windows
BrainFudger native AppKit GUI on macOS
AppKit GUI — macOS
BrainFudger native desktop GUI on Linux
Desktop GUI — Linux
BrainFudger CLI compiling a .bf source file
CLI — compiling a .bf source to a native executable

Windows

win-x64PE32+
win-x86PE32

macOS

osx-arm64Mach-O

Linux

linux-x64ELF64
linux-x86ELF32
linux-arm64ELF64

MS-DOS

msdos-com.COM
msdos-exeMZ .EXE

Eight binary backends

Pluggable emitter architecture — each of the eight targets writes its own binary format from scratch. No linker, no libc.

Bracket validation

Loop brackets are validated at compile time. Mismatched [ and ] produce clear errors before a single byte is written.

Tape bounds checking

The generated binary includes bounds checks on pointer moves. Stepping off either end of the tape reports an error at runtime instead of silently corrupting memory.

Native GUI hosts

Ships with a native Win32 app on Windows, an AppKit app on macOS, and a Linux desktop host — all backed by the same compiler core as the CLI.

Compile and run

--run compiles to a temp file, executes it immediately, then cleans up. Pair with --quiet-run to see only the program's output.

Custom branding

MSBuild BrandingDirective property switches between sanitised and uncensored builds — or activates the BrainFux0r alternate persona.

Compile to a specific target
BrainFudger.exe hello.bf -o hello.exe --target win-x64
BrainFudger.exe hello.bf -o hello     --target linux-x64
BrainFudger.exe hello.bf -o hello.com --target msdos-com
BrainFudger.exe hello.bf -o hello     --target osx-arm64
Compile and run immediately
BrainFudger.exe hello.bf --run
BrainFudger.exe hello.bf --run --quiet-run
List all available targets
BrainFudger.exe --list-targets
Build options — custom tape size
BrainFudger.exe hello.bf --target linux-x64 --cells 65536

Requires the .NET SDK. Clone the repo and publish a release build — the output is a self-contained executable.

Build
git clone https://github.com/KiwiGeek/BrainFudger
cd BrainFudger
dotnet publish -c Release