mindblown
Brainfuck to x86 ELF compiler with batteries included written in Rust meant for Linux and Windows under WSL. Code generation is made from brainf**k directly to x86 Intel assembly as IR. Most of the optimization work is done when parsing, so an integrated interpreter can benefit from it too.
This is in a very early state. Stay tuned for more features and optimizations like the ones described in TODO.
Note:
samples/patterns.pywas solely used for detecting common loop patterns in classical brainf**k programs for present and future refactoring.
Table of Contents
Prerequisites
Getting started
Get the latest binary release installed on your machine
# Get the latest cargo release
# Build from source
Usage
)
If no subcommand is provided,
mindblownwill default to the intergrated interpreter, which also uses the snailquote syntax for input. Please refer to their documentation for more information.
Compile a brainf**k program
<FILE> The
Inspiration
- https://github.com/pretzelhammer/rust-blog/blob/master/posts/too-many-brainfuck-compilers.md#intro-to-x86 for the x86 assembly codegen
- https://github.com/pretzelhammer/brainfuck_compilers/blob/master/src/x86_64/compiler.rs for examples of the x86_64 assembly codegen in Rust
- http://calmerthanyouare.org/2015/01/07/optimizing-brainfuck.html for optimizing brainf**k
- http://brainfuck.org for most programs in the
samplesfolder
TODO
- Make the interpreter take in newlines
- Add various CLI features such as choosing the output file, etc.
- Implement clearer and smarter error handling
- Optimize loop handling to Assembly
- Allow for more optimization