Brainfuck interpreter written in rust
Go to file
b1ek 4d93b7c0d6
add BrainFuckError to pass memory with the error message
2023-08-22 23:49:44 +10:00
examples don't throw runtime error when stdin closes 2023-08-22 22:46:18 +10:00
src add BrainFuckError to pass memory with the error message 2023-08-22 23:49:44 +10:00
.gitignore init repo 2023-08-22 17:28:55 +10:00
Cargo.toml init repo 2023-08-22 17:28:55 +10:00
README.md fix readme 2023-08-22 17:46:13 +10:00

README.md

BrainRustFucked

YABI (Yet Another Brainfuck Interpretator)
This is designed to embed BrainFuck for applications.

This library provides 2 functions:


/**
 * Eval the code from a raw string returning the memory
 */
fn eval(bf_str: &&str) -> Result<[u8; 30000], String>

/**
 * A more low level function to run code in custom environment  
 * This is useful when you want to use presetted memory & pointer
 */
fn eval_mem(bf_str: &&str, mem: &mut [u8], pointer: &mut usize) -> Result<(), String>

Example code:

// print "Hello world!"
eval(&"++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.").unwrap();

Also check out examples/ directory