From 036663873024fb364a913d01c101bac1c733e629 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Wed, 17 Nov 2021 18:09:06 +0100 Subject: Added README --- .gitignore | 1 + README.md | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 README.md diff --git a/.gitignore b/.gitignore index d37163e..b7defc8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ a.out bin/* asm/* bfc +tags diff --git a/README.md b/README.md new file mode 100644 index 0000000..433528c --- /dev/null +++ b/README.md @@ -0,0 +1,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/ -- cgit