Crates.io | mindblown |
lib.rs | mindblown |
version | 0.4.1 |
source | src |
created_at | 2022-09-08 02:27:01.165508 |
updated_at | 2022-09-29 20:44:14.997191 |
description | Brainfuck to x86 ELF compiler with batteries included. |
homepage | |
repository | |
max_upload_size | |
id | 660741 |
size | 72,154 |
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.py
was solely used for detecting common loop patterns in classical brainf**k programs for present and future refactoring.
Get the latest binary release installed on your machine
# Get the latest cargo release
$ cargo install mindblown
# Build from source
$ git clone https://github.com/Noxtal/mindblown.git
$ cd mindblown
$ cargo build --release
mindblown 0.4.0
Brainfuck to x86 ELF compiler with batteries included.
USAGE:
mindblown [SUBCOMMAND]
OPTIONS:
-h, --help Print help information
-V, --version Print version information
SUBCOMMANDS:
compile Compiles a Brainfuck file.
help Print this message or the help of the given subcommand(s)
If no subcommand is provided,
mindblown
will default to the intergrated interpreter, which also uses the snailquote syntax for input. Please refer to their documentation for more information.
mindblown-compile
Compiles a Brainfuck file.
USAGE:
mindblown compile [OPTIONS] <FILE>
ARGS:
<FILE> The Brainfuck file to compile.
OPTIONS:
-h, --help Print help information
-o, --output <OUTPUT> The output file.
-r, --run Run the compiled executable after compiling.
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 samples
folder