一种高级编程语言,可编译成 brainfuck 专业编程语言
brain is a strongly-typed, high-level programming language that compiles into brainfuck. Its syntax is based on the [Rust programming language][rust] (which it is also implemented in). Though many Rust concepts will work in brain, it deviates when necessary in order to better suit the needs of brainfuck programming.
+, -, >, `,>,>,>,>+++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++.--------------------.+++++++++++++++++++++++++++++.------------ -----------------.------------------------- -------++++++++++.----------,>,> ,>,>>++++++++++++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++++.------------------------- -----------------------------------------.+ ++++++++++++++++++++++++++++.-------------- ---------------.--------------------------- -----.>.>.>.>>++++++++++.----------
Run this after compiling with `brainfuck input.bf < someinputfile.txt`.
## Installation
For people just looking to use brain, the easiest way to get brain right now
is to first install the [Cargo package manager][cargo-install] for the
Rust programming language.
**NOTE: Until this version is released, these instructions will NOT work. Please
see the Usage instructions below for how to manually install the compiler from the
source code.**
Then in your terminal run:
cargo install brain cargo install brain-brainfuck
If you are upgrading from a previous version, run:
cargo install brain --force cargo install brain-brainfuck --force
…cargo run filename.brn
where `filename.brn` is the brain program you want to compile
Use `--help` to see further options and additional informationcargo run -- --help
**If the brain compiler seems to be taking too long or "hanging", try running
`cargo build` first to see if the Rust compiler is just taking too long for
some reason.**
You can also install the compiler from the source code using this command in the
repository's root directory:
cargo install --path .
## Examples
There are various brain examples in the `examples/` directory which you can
compile into brainfuck using the usage instructions above.
## Thanks
This project would not be possible without the brilliant work of the many
authors of the [Esolang Brainfuck Algorithms][bf-algorithms] page. The entire
wiki has been invaluable. That page in particular is the basis for a lot of the
code generation in this compiler. I have contributed many novel brainfuck
algorithms to that page as I come up with them for use in this compiler.
[brainfuck]: http://www.muppetlabs.com/~breadbox/bf/
[rust]: https://www.rust-lang.org/
[cargo-install]: https://crates.io/install
[bf-algorithms]: https://esolangs.org/wiki/Brainfuck_algorithms
[brainfuck-interpreter]: https://github.com/brain-lang/brainfuck
[bf-spec]: https://github.com/brain-lang/brainfuck/blob/master/brainfuck.md暂无开放 Issues,或尚未同步最近议题。