Skip to main content

Brainfuck JIT interpreter in Python

Project description


What's this? A fast brainfuck JIT interpreter!

How to use?

To use it, you can either write your code like this:

from jitbf import bf2jit
code='<code>'
jit=bf2jit(code)
jit()

, or use the jitbf command.

You have to install tha package 'llvmlite' before using this package.

How fast is it?

I compared this JIT interpreter with the Quick Dirty Interpreter In C. The brainfuck code used in the test is mandel.b. The operating system used in the test is Windows 10 64 bit.

Interpreter: jitbf 1.0.0 Time to run: 3.5764139s

Interpreter: jitbf 1.0.1 Time to run: 3.2445391s

Interpreter: Quick Dirty Interpreter In C Time to run: 8.3990561s

The

How does it work?

The package is based on LLVM, it first translates brainfuck into LLVM IR code, then uses llvmlite to compile and run it.

How will you improve it in the future?

I will improve it by making the LLVM IR code it translates smaller, and runs faster. (already done in this version)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jitbf-1.0.1.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

jitbf-1.0.1-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page