Brainc is a toolset that allows you to execute brainfuck code efficiently due to its implementation written in pure C. For compilation, the toolset offers to its user only the x86-64 processor architechture; the files compiled are in ELF64 format.
It's used GNU Make tool and any C compiler (either gcc or clang) to compile the source code. You would also need NASM assembler. You can execute the following instruction in your terminal:
make
You will find yourself with a new directory called build
in the project's root folder in which you find the executable brainc
which is the compiler itself.
The toolset has the following flags:
Flag | Description |
---|---|
-h --help |
Outputs help information about the compiler |
-v --version |
Outputs version of the compiler |
-i --interpret |
Interprets the source .bf file |
-c --compile |
Compiles the source .bf file down to ELF64 executable |
-o --output |
Used with -c or -S flags. Compiles the source .bf file down to ELF64 executable with a specified name |
-S |
Outputs assembly generated by the compiler |
You can find examples in the examples
directory and execute them with the toolset.
Links to the examples:
- Hello world: Wikipedia
- Calculator: Dougaak/Brainfuck-Calculator
Make sure to read the CONTRIBUTING.md file before making pull requests to this repository.