Crates.io | bflib |
lib.rs | bflib |
version | 0.1.9 |
source | src |
created_at | 2023-10-30 15:01:43.769128 |
updated_at | 2023-10-31 10:37:07.00472 |
description | a BrainFuck-to-Rust transpiler using Rust proc macro. |
homepage | |
repository | https://github.com/HellOwhatAs/brainfuck |
max_upload_size | |
id | 1018570 |
size | 12,396 |
More precisely, the BrainFuck-to-Rust transpiler using Rust proc macro
brain_fuck!(
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.
>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
);
into
method to obtain (pc: usize, mem: Vec<u8>)
after running
(run on into
calling)
let (pc, mem) = brain_fuck!(
++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[
-<<<[
->[+[-]+>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<
]>.>+[>>]>+
]
).into();
println!("{:?}", (pc, mem));
env
method to set Program Counter pc
and Memory mem
for brainfuck codeblock
(run on dropping)
brain_fuck!(
[.>]
).env(0, vec![79, 75, 10]);
into
calling)
let (pc, mem) = brain_fuck!(
[.>]
).env(0, vec![72, 101, 108, 108, 79, 119, 104, 97, 116, 65, 115, 10]).into();
println!("{:?}", (pc, mem));