fck

Crates.iofck
lib.rsfck
version0.1.2
sourcesrc
created_at2024-11-24 22:06:09.871913
updated_at2024-12-07 01:26:25.830987
descriptionA simple Brainfuck parser, lexer and interpreter.
homepage
repository
max_upload_size
id1459650
size28,807
Sol Wolf (swolfenden9)

documentation

README

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)?;
}
Commit count: 0

cargo fmt