brainfrsck

Crates.iobrainfrsck
lib.rsbrainfrsck
version1.0.4
sourcesrc
created_at2019-10-26 05:40:29.275214
updated_at2019-11-05 16:13:15.971419
descriptionAn easy-to-use brainfuck interpreter
homepage
repositoryhttps://www.github.com/charliethomson/brainfrsck
max_upload_size
id175839
size23,063
Charlie Thomson (charliethomson)

documentation

https://docs.rs/brainfrsck

README

brainfrsck

A brainfrick interpreter written in safe rust

Usage

The main entry point is the eval_string function

Example

use brainfrsck::prelude::eval_string;

let hello_world = "++++++++[>++++[>++>+++>++
+>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++
.>>.<-.<.+++.------.--------.>>+.>++.";

assert_eq!(
    eval_string(hello_world, None)?.to_string(),
    "Hello World!\n".to_owned(),
);

Notes

  • 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
Commit count: 0

cargo fmt