Expand description
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);
Modules§
- Contains various default memory allocators for the Brainfuck Virtual Machine trait
Structs§
- An out-of-bounds access error returned by the Brainfuck VM if an access is attempted outside the allocated memory region, without dynamic allocation being enabled
- Struct representing a complete Brainfuck program. The program does not need to be constructed directly, and is instead constructed automatically through the various
run_*
methods defined on theBrainfuckVM
trait. - A builder struct for the default implementation of
BrainfuckVM
Create the default configuration withVMBuilder::new()
orVMBuilder::default()
, customize with the member functions, and build the final VM withVMBuilder::build()
Enums§
- A fatal error encountered by the Brainfuck VM during program execution.
- Represents a single Brainfuck instruction
- The kind of missing jump instruction
- A general memory error encountered during runtime by the VM
Traits§
- A trait representing an object that is capable of allocating memory for a Brainfuck VM
- This trait represents an object that is able to run Brainfuck programs, either from a string of Brainfuck source code or by reading a Brainfuck source file
Type Aliases§
- The result of the execution of a Brainfuck program