Skip to content
A brainfuck compiler written in PHP. Also, a brain-eating amoeba.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
doc initial version Oct 22, 2014
examples
src
.gitignore
LICENSE
README.md

README.md

Naegleria

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.

Usage

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!

Platforms

Targets 64-bit x86 on linux, specifically gcc.

Limitations

The compiler uses a fixed-size array of 4000 elements for the cells.

Performance

It's assembly, so probably faster than C.

Benchmarks

Run your own.

Optimizations

This is not (yet) an optimizing compiler.

Acknowledgements

  • Thanks to @nikita_ppv for planting the idea a long time ago.
  • Thanks to @codeoracle for the inspiration to pick up gcc -S.
  • Thanks to @dazzlog for helping understand assembly.
  • Thanks to @old_sound for coming up with the name and logo.
  • Thanks to the Esolang wiki for being a great resource.
You can’t perform that action at this time.