aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--README.md27
2 files changed, 28 insertions, 0 deletions
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/