Bitbucket is a code hosting site with unlimited public and private repositories. We're also free for small teams!

Close
  __ __ _ ___ _  _  __    _  _  _ ___    __    _      __ _     _ ___    __ _ 
 |_ (_ / \ | / \|_)|_    |_)|_)|_| | |\||_ | |/ |/   /  / \|V||_) | |  |_ |_)
 |____)\_/ | \_/|  |__   |_)| \| |_|_| ||  |_|\_|\   \__\_/| ||  _|_|__|__| \

                  by Kang Seonghoon <esotope+bfc@mearie.org>


This is the Esotope Brainfuck Compiler: the world's most optimizing Brainfuck-
to-something compiler. Well, it is not a Something-to-Brainfuck compiler like
Jeffry Johnston's BFBASIC, but it translates the Brainfuck code into efficient
target language code (and possibly human-readable), so in this sense it is
actually a _decompiler_ rather than compiler.

There are many Brainfuck-to-C compilers (or Brainfuck-to-ELF compiler, and so
on) available, but there are almost no compiler which can translate the
following Brainfuck code:

    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.>>>++++++++[
    <++++>-]<.>>>++++++++++[<+++++++++>-]<---.<<<<.+++.------.--------.>>+.

...into something like the following code:

    /* generated by esotope-bfc */
    #include <stdio.h>
    #include <stdint.h>
    #define PUTS(s) fwrite(s, 1, sizeof(s)-1, stdout)
    static uint8_t m[30000], *p = m;
    int main(void) {
        PUTS("Hello World!");
        return 0;
    }

Surprisingly I had seen no compiler reached this one! So I started to make my
own compiler; Esotope Brainfuck Compiler is the result. (Actually, there are
now one or two other compilers reached this state, but they are inspired by
Esotope Brainfuck Compiler.)


                                   ==========
                                   HOW TO USE
                                   ==========

Esotope Brainfuck Compiler requires Python 2.5 or later. Optionally you can
use Psyco JIT compiler for better performance; Psyco is certainly required for
very large Brainfuck code, including Jon Ripley's The Lost Kingdom.

Use "esotope-bfc" Python script to invoke Esotope Brainfuck Compiler. It can
read the code from the given file, or standard input ("-"):

    $ ./esotope-bfc -
    +[]
    ^D
    /* generated by esotope-bfc */
    #include <stdio.h>
    #include <stdint.h>
    static uint8_t m[30000], *p = m;
    int main(void) {
        while (1); /* infinite loop */
    }


                                    =======
                                    LICENSE
                                    =======

Esotope Brainfuck Compiler is written by Kang Seonghoon. It can be freely
used and redistributable under the terms of MIT license.

Recent activity

Nothing to see here, move along.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.