Crates.io | bfi |
lib.rs | bfi |
version | 0.2.2 |
source | src |
created_at | 2017-08-23 15:16:58.888802 |
updated_at | 2017-08-24 15:12:41.994186 |
description | Brainfuck for your machine learning needs |
homepage | |
repository | https://github.com/levzhazeschi/rust-bfi |
max_upload_size | |
id | 28717 |
size | 16,532 |
Simple and fast Brainfuck interpreter perfectly suited for machine learning needs.
extern crate bfi;
use bfi::{BfMachine, b};
let code = b("+++[->,.<]"); // `b` converts an `&str` to a byte vector: `pub fn b(s: &str) -> Vec<u8>`
let input = b("jackdaws love my big sphinx of quartz");
let mut output = Vec::new();
let mut machine = BfMachine::new();
let res = machine.exec(&code, &input, &mut output);
assert_eq!(output, b("jackdaws"));
assert_eq!(res, Ok(code.len()));
Here they are.
Err(BfError::Memory)
.I like idea of Brainfuck as an environment for reinforcement learning. After searching crates, I haven't found anything decent for interpreting BF in runtime, so I wrote this little thing.