Skip to content

Akiko97/brainfuck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brainfuck

A simple brainfuck interpreter, with JIT support.

Prerequisites

macOS

You need to install llvm@18 and zstd using Homebrew:

brew install llvm@18 zstd

Linux

You need to install llvm-18-dev and libpolly-18-dev:

sudo apt install llvm-18-dev libpolly-18-dev

Build

cargo build --release

Run

./target/release/bf <path-to-bf-file>

Or run with cranelift-jit/llvm-jit:

./target/release/bf <path-to-bf-file> jit --method [cranelift | llvm]

If you want to dump the ir:

./target/release/bf <path-to-bf-file> jit --method [cranelift | llvm] --dump-ir

FAQ

Build with LLVM Support

If you encounter issues about missing LLVM_SYS_xxx_PREFIX, you can build with the following command:

macOS

LLVM_SYS_180_PREFIX="/opt/homebrew/opt/llvm@18" cargo build --release

Ubuntu

LLVM_SYS_180_PREFIX="/usr/lib/llvm-18" cargo build --release

Customizing LLVM Environment Variables

If you need to modify LLVM-related environment variables, refer to .cargo/config.toml.

LICENSE

This project is licensed under the MIT License.

Acknowledgements