1 stable release
1.1.0 | Jan 6, 2021 |
---|
#1631 in Development tools
29KB
737 lines
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.
Dependencies
~0.4–1MB
~22K SLoC