Observed since 20 Oct, 19:57 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
High-performance Brainfuck interpreter with JIT acceleration, library imports, and interactive REPL
A high-performance Brainfuck language interpreter for Python with JIT acceleration, library imports, and an interactive REPL.
Documentation | PyPI | Changelog
@jit(nopython=True) for 3-5x speedup,, *, &) trigger checkpoints where Python handles input/output before resuming JIT execution.bf files with {libname} syntax; recursive imports supportedbrainfuck with no arguments for an interactive shellfrom brainfuck import BrainFuck for programmatic usepip install advanced-brainfuck
# Run a program and exit
brainfuck --command-line '++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.'
# Run a program from file (recommended for large programs)
brainfuck --command-line -f program.b
# Run a program then enter interactive REPL
brainfuck '+++++++++++++++++++++++++++++++++++++++++++++++++++.'
# Redirect output to a file
brainfuck --command-line --output result.txt '+++++++++[>++++++++<-]>+.'
# Save tape state after execution
brainfuck --command-line --dump tape.json '+++'
# Load tape state, run program, and dump result
brainfuck --command-line --load tape.json --output result.txt --dump out.json '.>+++.'
# Enter interactive REPL
brainfuck
from brainfuck import BrainFuck
bf = BrainFuck()
bf.execute('+++++++++++++++++++++++++++++++++++++++++++++++++++.') # prints: 3
bf.execute('[-]') # clears cell 0
bf.execute('{p10}*{tochar}') # imports and prints: |10|
bf.execute('&') # prints command history
bf.save_tape('tape.json') # save tape state to file
bf.load_tape('tape.json') # restore tape state from file
bf.interpreter() # starts interactive REPL
| Command | Description |
|---|---|
> | Increment the data pointer |
< | Decrement the data pointer |
+ | Increment the value at the data pointer |
- | Decrement the value at the data pointer |
. | Output the value at the data pointer |
, | Accept one integer of input |
[ | Jump forward past matching ] if value is zero |
] | Jump back to matching [ if value is non-zero |
| Command | Description |
|---|---|
{LIB} | Import external Brainfuck code from bflib/LIB.bf |
* | Output all cells with pointer highlighted |
& | Output command history |
help | Show command reference (REPL only) |
quit / exit | Exit the REPL |
save [FILE] | Save tape state to JSON file (default: tape.json, REPL only) |
The bflib/ directory contains 31 reusable Brainfuck modules:
| Module | Description |
|---|---|
sum | Sum current cell and next cell |
sub | Subtract next cell from current cell |
mul | Multiply current cell by next cell |
mul2 | Multiply current cell by two |
div | Divide current cell by next cell |
mod | Modulo of current cell divided by next cell |
copy | Copy current cell into next cell |
move | Move current cell to next cell (copy + clear) |
swap | Swap current cell and next cell |
zero | Clear current cell (set to zero) |
not | Logical NOT of current cell |
and | Logical AND of current and next cell |
or | Logical OR of current and next cell |
eq | Test if current cell equals next cell |
if | If current cell is non-zero, set next cell to 1 |
sqrt | Integer square root of current cell |
p5 | Add 5 to current cell |
p10, p32, p48, p50, p65, p100 | Add 5, 10, 32 (space), 48 (digit '0'), 50, 65 ('A'), 100 to current cell |
m10, m50, m100 | Subtract 10, 50, 100 from current cell |
toint | Convert ASCII digit character to integer |
tochar | Convert integer (0-9) to ASCII character |
newline | Output a newline character (ASCII 10) |
lower | Convert uppercase ASCII to lowercase |
upper | Convert lowercase ASCII to uppercase |
Source Code → Import Resolution → IR Compilation → Execution
↓
┌── Segmented JIT ──┐
│ execute_jit() │
│ via Numba │
│ │
│ Checkpoints at: │
│ , * & │
│ │
│ Python handles I/O │
│ then resumes JIT │
└────────────────────┘
┌── Fallback ────────┐
│ (JIT compilation │
│ failure only) │
│ Python IR loop │
└────────────────────┘
Source code is compiled to an intermediate representation with:
+++++ becomes ('add', 5) in a single operation[ and ] targets are computed at compile timeCells use a pre-allocated NumPy tape of 65,536 cells (64K) for JIT execution, with a hybrid Python storage model for the REPL:
defaultdict for negative indices (rarely used but supported)advanced-brainfuck/
├── brainfuck/ # Python package
│ ├── __init__.py # Public API re-exports
│ ├── __main__.py # python -m brainfuck entry point
│ ├── core.py # Core interpreter, compiler, JIT, CLI
│ └── bflib/ # Reusable Brainfuck library modules
│ ├── sum.bf
│ ├── copy.bf
│ ├── mul.bf
│ ├── div.bf
│ ├── toint.bf
│ └── ... # 31 modules total
├── docs/
│ ├── spec/ # Product & technical specifications
│ ├── adr/ # Architecture decision records
│ └── features/ # Feature specifications
├── tests/
│ └── features/ # Test files
├── pyproject.toml # Package configuration
└── README.md
GPLv3 — See LICENSE for details.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 2.2.0 | 3 May 2026 | 7 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 20 Oct, 19:57 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:0921aaf6d05be47baa89abffa4bedaa5c633ba094a062075dab8eec1896acdc6