#brainfuck #bf #macro #inline #brainfuck-compiler #execution #splash

nightly macro bin rsfk

A library that provides inline brainfuck execution as macros

1 unstable release

0.1.0 Apr 2, 2024

#923 in Procedural macros

MIT license

9KB
137 lines

rsfk 🦀

Brainfuck "compiler", written with Rust, macros and a splash of ❤️

How to use this project?

Prerequisite

Command

  • cargo run to execute main.rs

Usage

Macro

inline_bf! ( (Instance of rsfk_core::BrainfuckState) {BF instruction} )

use rsfk;

fn main() {
  let mut bf = rsfk_core::BrainfuckState::<u32>::new();
  rsfk::inline_bf!( (bf), { ++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++. } );
  println!("{:?}", &bf);
}

// Hello World!

Roadmap, probably

  • Basic code
  • Cargo upload
  • Input fix (ParseIntError { kind: InvalidDigit })
  • Test cases
  • CI/CD on GitHub Action
    • Separate Cargo/ GitHub branch
    • Auto release onto Cargo when PR is merged to the branch
  • Optimizations
    • Repeated instructions into one function call
  • Standalone bf compiler?
  • Detailed control over the state of the machine?
    • Preload memory
    • Step execution (Possible?)

Dependencies

~475KB