https://github.com/mukel/bf
TruffleBrainf*ck interpreter
https://github.com/mukel/bf
Last synced: 12 months ago
JSON representation
TruffleBrainf*ck interpreter
- Host: GitHub
- URL: https://github.com/mukel/bf
- Owner: mukel
- License: gpl-2.0
- Created: 2021-05-03T17:14:45.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-06-30T09:53:51.000Z (about 1 year ago)
- Last Synced: 2025-07-05T04:14:31.172Z (12 months ago)
- Language: Java
- Size: 68.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bf
Truffle Brainf*ck (bytecode) interpreter.
### Build
A few configurations are provided: `jvm`, `jvm-ce`, `jvm-ee`, `native-ce` `native-ee`.
The `jvm-*` run on `jargraal` instead of `libgral` to avoid re-building `libjvmcicompiler.so` every time.
```bash
mx --env native-ee build
```
### Run
```bash
mx --env native-ee bf --experimental-options --log.level=ALL --engine.Mode=latency --engine.BackgroundCompilation=false --engine.CompileImmediately=true --engine.TraceCompilationDetails demos/mandelbrot.bf
```
`--engine.BackgroundCompilation=false --engine.CompileImmediately=true` ensures that BF programs are fully compiled before execution.
`--engine.Mode=latency` is **strongly recommended** to avoid abysmal compilation times due to optimization phases with pathological non-linear complexity.
`--log.level=ALL` logs the time taken to execute a BF program.
`--engine.TraceCompilationDetails` logs compilation events including time taken by partial evaluation and compilation.
`--engine.Compilation=false` disables compilation, useful to test interpreter performance.
### Debug
To attach the debugger to run in JVM mode as follows:
```bash
mx --env jvm-ee build
mx --env jvm-ee bf --experimental-options --vm.agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=y --log.level=ALL --engine.Mode=latency --engine.BackgroundCompilation=false --engine.CompileImmediately=true --engine.TraceCompilationDetails demos/mandelbrot.bf
```