This repository hosts a Brainfuck compiler for Linux x86-64 systems written in Go. It translates the source file to highly-optimized GNU assembly code and compiles it using GCC.
Run make
to compile the compiler itself. Alternatively, download the binary of the latest release from here.
You can then compile a Brainfuck source file by invoking bf <FILE>
. Several command-line options exist, which can be viewed with bf --help
.
With make check
, a suite of test programs will be compiled and run. Most of the tests are taken from Wikipedia, while one test has been created by Felix Nawothnig.
The following test case has been used for benchmarking the compiler: factor.b
by Brian Raiter with input 6543210987654321
. The code has been compiled with different compilers enabling the highest optimization level.
Compiler | Runtime |
---|---|
ebfc (commit e7fba94) | 23 seconds |
bfc (version 1.7.0) | 8.5 seconds |
this repository | 7 seconds |