Optimized Brainfuck Interpreter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Matthilde 92a67e6211 Added JIT 11 months ago
.gitignore First commit 1 year ago
LICENSE First commit 1 year ago
README.txt Added JIT 11 months ago
benchmark.txt Added JIT 11 months ago
bfvm.c Added JIT 11 months ago
hello.bf First commit 1 year ago
mandelbrot.bf First commit 1 year ago
naive.c First commit 1 year ago


BFVM by matthilde

This is an optimized brainfuck interpreter that uses a VM with an instruction
set designed to run brainfuck.
The assembler includes a few optimizations to improve speed greatly.
And it now includes a Just-In-Time compiler (JIT) that is even faster.

NOTE: The JIT has been designed to run on x86-64 CPUs, if you have something
else, the JIT will not work.
And since it uses mmap, it only works for Linux.
However nothing prevents you to port this interpreter, if it's even worth


bfvm.c - The brainfuck interpreter, code is commented
naive.c - A naive brainfuck interpreter I wrote a year ago
benchmark.txt - The benchmarks
hello.bf - Hello World
mandelbrot.bf - A copy of the mandelbrot fractals algorithm in brainfuck


Compiling the brainfuck interpreter

cc bfvm.c -O3 -o bfvm

Compiling the naive brainfuck interpreter

cc naive.c -o naive


bfvm [-vjc] FILENAME
-v is to enable verbose logs, used to debug the assembler
-j is to enable JIT mode
-c is to enable compiler mode (will output x86 code)



Look, I don't care about this piece of software. Do whatever you want with it
tbh, belongs to public domain i guess