Skip to content
A Brainfuck interpreter and optimizing compiler written in Go
Go Brainfuck Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Godoc Build Status


This is a BF interpreter and optimizing compiler written in Go.

GoBF can simply run your BF program or compile it to a binary to run later.

Obligatory Install Line

go get


The commandline program currently supports compile, gengo, run, and dumpil actions.

Give it a try!

go get

gobf compile

Note that the run command will simply interpret the BF program in-place, thus the performance will be as-is. Please use the compile to generate an optimized program.

Please see gobf --help for more fun options!


The generated code optimizer reduces redundant and repetitive commands, like data pointer moves or incrementing a data cell. It coalesces multiple moves or data cell changes into one operation. Due to BF's repetitive nature, this typically increases the BF program's performance dramatically. All of the interesting optimization stuff is in gobflib/il package.

Recent work has added some pattern and vectorization based optimizations, but these have not been fully calibrated yet.

To try the zero pattern optimization, invoke gobf in the following manor:

gobf -O zero compile
You can’t perform that action at this time.