fast brainfuck interpreter written in C
Go to file
Matthilde 92a67e6211 Added JIT 2021-11-02 16:49:39 +01:00
.gitignore First commit 2021-06-24 14:15:27 +02:00
LICENSE First commit 2021-06-24 14:15:27 +02:00
README.txt Added JIT 2021-11-02 16:49:39 +01:00
benchmark.txt Added JIT 2021-11-02 16:49:39 +01:00
bfvm.c Added JIT 2021-11-02 16:49:39 +01:00 First commit 2021-06-24 14:15:27 +02:00 First commit 2021-06-24 14:15:27 +02:00
naive.c First commit 2021-06-24 14:15:27 +02:00


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 World - 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