add README.md

This commit is contained in:
b1ek 2023-08-22 17:45:31 +10:00
parent cf542c8b2b
commit f80f252eb0
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 27 additions and 0 deletions

27
README.md Normal file
View File

@ -0,0 +1,27 @@
# BrainRustFucked
YABI (Yet Another Brainfuck Interpretator)
This is designed to embed BrainFuck for applications.
This library provides 2 functions:
```rs
/**
* 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:
```rs
// print "Hello world!"
eval("++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.").unwrap();
```
Also check out `examples/` directory