6 releases

0.1.5 Mar 20, 2024
0.1.4 Mar 18, 2024

#460 in Programming languages

Download history 255/week @ 2024-03-08 404/week @ 2024-03-15 58/week @ 2024-03-22 56/week @ 2024-03-29 17/week @ 2024-04-05

163 downloads per month
Used in cpr_bfvm

MPL-2.0 license

27KB
519 lines

cpr_bf

crate documentation

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

~555KB
~11K SLoC