Skip to content

A very speedy JIT compiler + interpreter for Brainfuck

License

Notifications You must be signed in to change notification settings

john-h-k/rustfuck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rustfuck

A brainfuck JIT and interpreter set

Why?

I wanted to write a brainfuck interpreter. They are inherently quite useless

What does it have?

rustfuck contains 4 interpreters as well as an optimising JIT-compiler (currently only available on AArch64).

The 4 backends:

  • BF interpreter - executes brainfuck, as-is
    • takes around 30s on mandelbrot.b
  • HIR interpreter - only fuses +-s and <>s, as well as creating a branch lookup table
    • takes around 5s on mandelbrot.b
  • LIR interpreter - additiionally performs a bunch of different loop optimisations to
    • takes around 2.7s on mandelbrot.b
  • JIT compiler - emits raw machine code (doesn't currently support reading from STDIN)
    • takes around 600ms on mandelbrot.b

There are several examples in the examples folder, including hello_world and mandelbrot.

About

A very speedy JIT compiler + interpreter for Brainfuck

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages