bfi - Brainfuck Interpreter

raw JSON →
1.1.1 verified Sat May 09 auth: no python

A fast optimizing Brainfuck interpreter in pure Python. Current version 1.1.1, released under MIT license. Development appears stable with infrequent releases.

pip install bfi
error ModuleNotFoundError: No module named 'bfi.bfi'
cause Incorrect import path (e.g., from bfi.bfi import interpret).
fix
Use 'from bfi import interpret' (module is bfi, not bfi.bfi).
error AttributeError: module 'bfi' has no attribute 'interpret'
cause Typo in function name or old version (<1.0.3) may lack the function.
fix
Check spelling: 'interpret' not 'interpreter'. Update to latest version: pip install --upgrade bfi.
error TypeError: execute() got an unexpected keyword argument 'time_limit'
cause Using time_limit argument which was removed in v1.1.0.
fix
Remove time_limit argument; use external timeout mechanism.
breaking In v1.1.0, the 'time_limit' argument was removed from bfi.execute. Calling execute with time_limit will raise an error.
fix Remove the time_limit argument; use a different approach (e.g., signal) to limit execution time.
deprecated The 'bin/bfi' script was removed in v1.1.0. Use 'python -m bfi' instead.
fix Run 'python -m bfi' instead of calling the script directly.

Run a Brainfuck program using the 'interpret' function, which returns output as a string.

from bfi import interpret

# Simple Brainfuck program that prints 'Hello'
program = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++."
output = interpret(program)
print(output)