Crates.io | brainfuckm |
lib.rs | brainfuckm |
version | 0.1.0 |
source | src |
created_at | 2022-01-25 19:40:24.799405 |
updated_at | 2022-01-25 19:40:24.799405 |
description | library to parse brainfuck source code |
homepage | |
repository | https://github.com/mztikk/brainfuck |
max_upload_size | |
id | 521038 |
size | 8,822 |
Rust library built on top of poetic to parse brainfuck.
There are tests for the parser which you can run with:
cargo test
It will first parse the string source input and parse it to only contain brainfuck opcodes.
let buf = fs::read_to_string("input.bf").unwrap();
let intermediate = Parser::parse_string(&buf);
These opcodes can then be turned into instructions
let mut instructions = Parser::parse_instructions(&intermediate);
which can then be optimized and interpreted by poetic see https://github.com/mztikk/poetic#usage