A brainfuck compiler written in PHP. Also, a brain-eating amoeba.
MIT License
A brainfuck compiler written in PHP.
Naegleria fowleri /nəˈɡlɪəriə/ (also known as the "brain-eating amoeba") infects people by entering the body through the nose.
You can use Naegleria to compile a brainfuck file into AT&T assembly. This can then be assembled using gcc
, and executed directly.
$ bin/compile examples/hello.b > hello.s
$ gcc -o hello hello.s
$ ./hello
Hello World!
Targets 64-bit x86 on linux, specifically gcc.
The compiler uses a fixed-size array of 4000 elements for the cells.
It's assembly, so probably faster than C.
Run your own.
This is not (yet) an optimizing compiler.
gcc -S
.