blob: 433528c29b3f946e41e4856fdf4d3855bfcb38ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# BrainFuck Compiler (bfc)
Compiles [Brainfuck][1] to assembly and compile it to machine code with [`nasm`][2].
## Usage
```
$ make
$ ./bfc < ./brainfuck.bf > ./brainfuck.asm
```
You can then compile the assembly with the following:
```
$ nasm -f elf64 -o brainfuck.o brainfuck.asm
$ ld -o brainfuck brainfuck.o
```
Use `-f macho64` instead of `-f elf64` if you're on MacOS.
## Examples
There is a few examples of brainfuck in the [examples directory](./examples/) (taken from Wikipedia).
After `make`, their executables are put in the `bin/` directory.
[1]: https://en.wikipedia.org/wiki/Brainfuck
[2]: https://nasm.us/
|