Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/detectivekaktus/brainc

Brainfuck x86_64 execution toolset written in pure C for Linux
https://github.com/detectivekaktus/brainc

assembly brainfuck c compiler interpreter linux make nasm nasm-assembly toolset x86-64

Last synced: 2 months ago
JSON representation

Brainfuck x86_64 execution toolset written in pure C for Linux

Awesome Lists containing this project

README

        

# brainc
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.

## Compilation
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:
```console
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.

## Usage
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 |

## Examples
You can find examples in the `examples` directory and execute them with the toolset.

Links to the examples:
- Hello world: [Wikipedia](https://en.wikipedia.org/wiki/Brainfuck)
- Calculator: [Dougaak/Brainfuck-Calculator](https://github.com/Dougaak/Brainfuck-Calculator/tree/master)

## Contribution
Make sure to read the [CONTRIBUTING.md](https://github.com/detectivekaktus/brainc/blob/master/CONTRIBUTING.md) file before making pull requests to this repository.