bfc-rs

Crates.iobfc-rs
lib.rsbfc-rs
version1.1.0
sourcesrc
created_at2021-01-06 04:09:25.319134
updated_at2021-01-06 04:09:25.319134
descriptionA Brainfuck compiler for x86-64 Linux implemented in Rust.
homepage
repositoryhttps://github.com/oreganoli/bfc-rs/
max_upload_size
id332866
size35,460
(oreganoli)

documentation

README

BFC-RS

BFC-RS is a feature-complete Brainfuck compiler for x86_64 Linux implemented in Rust. You can read the (finished) Terrible Compiler for a Useless Language series of posts at my blog if you want to read about its development.

Features

  • generates a working executable for any Brainfuck program
  • optimizes programs at compile time to reduce disk space/memory usage and execution time
  • optionally produces an assembly code dump for manual inspection

Manual building and installation

cargo build and cargo install are entirely adequate.

Dependencies

BFC-RS requires nasm and ld to be available.

Usage

bfc-rs <source_filename> [-o <output-filename>] [--dump-nasm] [--no-cleanup]
Options:
  -o, --output-filename
                    output filename (must be provided unless --dump-nasm is
                    explicitly passed)
  --no-cto          disable compile-time optimizations
  --dump-nasm       instead of compiling, print raw NASM output to stdout for
                    debugging
  --no-cleanup      do not clean up build directory after successful build
  --help            display usage information

Licensing and attribution

As this code has to do with Brainfuck, we're already using the word "fuck", so I'd ordinarily see nothing wrong with licensing this code under the WTFPL. However, this repository uses the argh library, whose MIT license isn't compatible with that, as well as Daiki Maekawa's brainfuck-echo program used in the course of developing BFC-RS.

BFC-RS itself also uses the MIT license.

Commit count: 50

cargo fmt