feniljain / brenphuk

Brainfuck lang JIT interpreter using DynASM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Brenphuk

NOTE: Currently this project only works on linux x86_64 systems

What

A brainfuck language interpreter, this project contains 4 implementations of interpreter:

  • 1st: simple interpreter, most naive implementation, branch: attempt_1
  • 2nd: Optimization 1: precomputed brackets location, branch: attempt_2
  • 3rd: Optimization 2: combining repeated instructions work, branch: attempt_3
  • 4th: JIT, branch: attempt_4

Run

Deps:

  • readline
  • meson
  • ninja
  • dynasm (for attempt_4)

Meson and ninja:

mkdir build
meson setup build
cd build
meson compile && ./brenphuk

To reflect changes in build dir changing meson.build/branches:

meson setup --reconfigure build, to try building after changes

NOTE: For attempt_4 to get dynasm running properly, run ./dynasm_install.sh, that should setup everything for you :)

When binary is run without any args passed, it by default lands in repl mode. One can run tests using:

./brenphuk tests

Run benchmark using:

./brenphuk benchmark <number-of-iterations>

Run repl explicitly using:

./brenphuk repl

Benchmark Results

In first case trying to run without -O3 for mandelbrot, took more time than my patience allowed :P

Output

About

Brainfuck lang JIT interpreter using DynASM


Languages

Language:C 63.5%Language:Brainfuck 31.3%Language:Meson 2.3%Language:C++ 1.3%Language:Makefile 0.7%Language:Assembly 0.6%Language:Shell 0.3%