April 23, 2010

announcing awib 0.2

It may well be the best brainfuck compiler ever written in brainfuck. Today it gets even better.

We've been at it for more than a year and are finally able to announce the release of awib 0.2.

In addition to an already impressive feature set, boasting code optimization and support for multiple target platforms, awib 0.2 has many exciting new bells and whistles that you're bound to enjoy.

it's a polyglot!

The classic problem for self-hosting compilers is that of bootstrapping: with what will you compile the compiler?

Since it is arguably one of the largest hurdles standing in the way of widespread adoption, the awib development team has decided to attack this problem by making version 0.2 a three language polyglot. As of now, awib.b is not only valid brainfuck code, but is also a fully functional C program and a bash script. You can run it in your shell, you can build it with your C compiler and you can execute it in your brainfuck environment of choice.

Building awib-0.2.b with gcc is very simple:

$ cp awib-0.2.b awib.c
$ gcc awib.c -o awib.tmp
$ ./awib.tmp < awib-0.2.b > awib.c
$ gcc -O2 awib.c -o awib-0.2

Users without access to a C compiler can use bash instead:

$ (echo "@386_linux"; cat awib-0.2.b) | bash awib-0.2.b > awib-0.2
$ chmod +x awib-0.2

Obviously, since awib 0.2 is still valid brainfuck, it can also be compiled with older versions of awib:

$ (echo "@386_linux"; cat awib-0.2.b) | awib-0.1 > awib-0.2
$ chmod +x awib-0.2

go ruby

As if the C programming language and 386 Linux binaries was not enough, we've added two new compiler backends. In addition to the before mentioned, awib is now capable of compiling to Ruby and Google's sort of interesting new language Go.

To compile to Ruby, prepend the string "@lang_ruby" to the brainfuck source code you wish to compile. If you're going for Go, prepend the string "@lang_go". In case you've forgotten, the other two backends are selected with "@lang_c" and "@386_linux" respectively.

testing

Diving into the awib code base can be a daunting task. Many potential contributors are probably scared off by the difficulty in comprehending the consequences of even minor edits for the compiler as a whole.

With this and some other stuff in mind, we've added tests. Lot's of them. Unit tests for the backends. Unit tests for the frontend. System tests for the final build. Some of them take forever to run but we run them nonetheless.

In addition to hopefully making the code less off putting to other developers, the expanded test coverage has helped us to iron out a couple of nasty bugs and greatly improves our confidence in the correctness of awib 0.2.

getting it

We have what you want:

Don't forget to visit the awib project page at Google Code: http://awib.googlecode.com/.

Enjoy!

3 comments:

  1. Finally! I've been waiting for this a long time!
    Great work!

    ReplyDelete
  2. Seriously awesome code. I am blown away. Incredible ASCII art to boot. You sir are da dawg.

    ReplyDelete
  3. Bah, pr0n is for lamerz!

    ReplyDelete