Crates.io | brainfrsck |
lib.rs | brainfrsck |
version | 1.0.4 |
source | src |
created_at | 2019-10-26 05:40:29.275214 |
updated_at | 2019-11-05 16:13:15.971419 |
description | An easy-to-use brainfuck interpreter |
homepage | |
repository | https://www.github.com/charliethomson/brainfrsck |
max_upload_size | |
id | 175839 |
size | 23,063 |
A brainfrick interpreter written in safe rust
The main entry point is the eval_string
function
use brainfrsck::prelude::eval_string;
let hello_world = "++++++++[>++++[>++>+++>++
+>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++
.>>.<-.<.+++.------.--------.>>+.>++.";
assert_eq!(
eval_string(hello_world, None)?.to_string(),
"Hello World!\n".to_owned(),
);
eval_string
returns an InterpreterOutput
which is essentially a wrapper for a Vec<u8>
, it has methods to convert to a String
(to_string
) and to get the internal Vec
(to_vec
), as well as Debug
writing the Vec
and Display
writing the String