fck 0.1.2

A simple Brainfuck parser, lexer and interpreter.
Documentation
  • Coverage
  • 37.21%
    16 out of 43 items documented1 out of 12 items with examples
  • Size
  • Source code size: 28.32 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.77 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 27s Average build duration of successful builds.
  • all releases: 24s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • swolfenden9

FCK

Fck is a simple Brainfuck lexer, parser, and interpreter. It includes a library crate that exports most of the functionality, and an executable that provides a CLI for lexing, parsing, and executing Brainfuck programs.

Fck binary

To see a list of all commands, use:

fck --help

Examples

Using run and run_file.

use fck::{run, run_file};

fn main() -> fck::Result<()> {
  run("+++++++++.[->+<]")?;
  run_file("path/to/file")?;
}

Using the individual modules.

use fck::lexer::lex;
use fck::parser::parse;
use fck::interpreter::Interpreter;

fn main() -> fck::Result<()> {
  let tokens = lex("source code")?;
  let ast = parse(&tokens)?;
  let mut interpreter = Interpreter::new();
  interpreter.run(&ast)?;
}