https://github.com/akiko97/brainfuck
A simple brainfuck interpreter
https://github.com/akiko97/brainfuck
brainfuck brainfuck-interpreter brainfuck-jit cranelift cranelift-jit inkwell jit llvm llvm-ir llvm-jit peg rust rust-lang
Last synced: 2 months ago
JSON representation
A simple brainfuck interpreter
- Host: GitHub
- URL: https://github.com/akiko97/brainfuck
- Owner: Akiko97
- License: mit
- Created: 2024-12-22T12:36:31.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-01-03T16:08:09.000Z (6 months ago)
- Last Synced: 2025-03-26T07:36:26.693Z (3 months ago)
- Topics: brainfuck, brainfuck-interpreter, brainfuck-jit, cranelift, cranelift-jit, inkwell, jit, llvm, llvm-ir, llvm-jit, peg, rust, rust-lang
- Language: Rust
- Homepage: https://github.com/Akiko97/brainfuck
- Size: 24.4 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# brainfuck
A simple brainfuck interpreter, with JIT support.
## Prerequisites
### macOS
You need to install `llvm@18` and `zstd` using Homebrew:
```shell
brew install llvm@18 zstd
```### Linux
You need to install `llvm-18-dev` and `libpolly-18-dev`:
```shell
sudo apt install llvm-18-dev libpolly-18-dev
```## Build
```shell
cargo build --release
```## Run
```shell
./target/release/bf
```Or run with cranelift-jit/llvm-jit:
```shell
./target/release/bf jit --method [cranelift | llvm]
```If you want to dump the ir:
```shell
./target/release/bf 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
```shell
LLVM_SYS_180_PREFIX="/opt/homebrew/opt/llvm@18" cargo build --release
```#### Ubuntu
```shell
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](./LICENSE).
## Acknowledgements
* [bf-jit](https://github.com/QRWells/bf-jit)