6 releases
0.1.5 | Mar 20, 2024 |
---|---|
0.1.4 | Mar 18, 2024 |
#32 in #configurable
Used in cpr_bfvm
27KB
519 lines
cpr_bf
A simple Brainfuck interpreter library, featuring a configurable Brainfuck Virtual Machine.
lib.rs
:
A simple Brainfuck interpretation library
The library exposes the BrainfuckVM
trait, representing an object
that is able to run Brainfuck programs either from source code represented
as a string, or from a Brainfuck source file.
In addition to this general trait, it also provides the VMBuilder
struct,
that can be used to create a Brainfuck VM that is customizable through various
means.
Examples
To simply create a basic spec-compliant Brainfuck runner, and run some Brainfuck code:
let code = "++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.";
let vm = cpr_bf::VMBuilder::new().build();
vm.run_string(code);
Dependencies
~550KB
~11K SLoC