Simple BrainFuck toolkit written in haskell.
This project covers 3 things:
You can check it by yourself.
You need to install Stack before continue. Since you've got the Stack, you can simply install this project by running:
git clone https://github.com/s3rius/brainbreak.git
cd brainbreak
stack install
Additionally for compilation you need to have different compilers installed.
For C++
compilation you need to install clang++
.
You can just call bb
to enter REPL.
It works as ipython. Every time you hit the Enter button, code evaluates.
It's simple as is.
REPL itself inspired by the IPython project and looks similar to it. Addition commands:
In [0]: ++++
# Print current REPL state.
In [1]: :state
Current index: 0
Offset from start: 0
part of curren buffer:
[0,0,0,0,0,4,0,0,0,0,0]
# Print current buffer as list of integers.
In [2]: :buf
[0,0,0,0,0,4,0,0,0,0,0]
# Print current buffer as characters.
In [3]: :bufc
"\NUL\NUL\NUL\NUL\NUL\EOT\NUL\NUL\NUL\NUL\NUL"
To run brainbreak as interpreter you need to provide a brainFuck
file.
bb -i /path/to/file.bf
This command will optimize and evaluate the code from file.
To compile your bf files you need to provide input and output files. The backend option can be omitted.
bb -i /path/to/input.bf -o /path/to/output
# If you want to change compilation backend you can add option
bb -i /path/to/input.bf -o /path/to/output -b Cpp