blob: b6de46554b4ec4388f262c87c5d34b97c7181caa (
plain) (
blame)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# BFC - Brainf*ck compiler
A Brainf*ck compiler for Linux.
`bfc` translates Brainfuck into C and immediately feeds it into GCC, producing small standalone ELF executables. No interpreters, no virtual machines, no runtime dependencies.
## Build the compiler
Just one command:
`make`
## Build a brainfuck program
Just one more command:
`cat input.bf | ./build/bfc > output`
or:
`echo "bf string" | ./build/bfc > output`
Then running the program is as simple as:
`./output`
## How it works
Brainf*ck source -> Lexer -> Parser -> AST -> C codegen -> GCC -> ELF executable
A simple Hello World! program is about 9.3kb big.
## Limitations
* Linux only
* Soft-requires GCC (could be substituted for something else)
* Finite memory tape (30kb)
## Why?
Because interpreters suck.
Also because turning Brainf*ck into an ELF executable is just objectively fun.
## License
MIT
|