October 4, 2010

Tickling an itch: announcing awib 0.3

In April 2010, awib 0.2 hit the internet like a pile of bricks dropped from the 42nd floor. Few had expected such radical expansion of an already impressive feature set. Not only was Ruby and Google's Go added to the list of compilation targets, the compiler itself had been made polyglot in C and bash in addition to it's core language brainfuck. Still, we felt that something was missing.

It has been said that "every good work of software starts by scratching a developer's personal itch" [1]. It has also been said that "Tcl was not designed to be a serious programming language" [2]. With that in mind, and for no particular reason, we, the awib development team have decided to embrace the Tool Command Language, Tcl, as a central part of our endeavour.

the news

Awib 0.3, hereby announced, introduces:

  • Polyglotness in Tcl
  • A Tcl backend

In summary, awib 0.3 is:

  • a brainfuck compiler written in brainfuck
  • polyglot in Tcl, C, bash and brainfuck
  • optimizing
  • capable of compiling to
    • Linux executables (for i386)
    • Tcl
    • Ruby
    • Go
    • C

getting it

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!

January 31, 2010

awib up until 0.1

During the spring of 2002, members of what would later become the awib development team started hacking on a brainfuck to C translator. Since converting brainfuck to C is trivial and a non-trivial task was desired, the compiler was named wib and was to be written in brainfuck. Interested readers can fetch a copy of wib-0.96 here:
http://www.nada.kth.se/~matslina/awib/wib.b

A year or so later, wib was old news and a fresh challenge was needed. The team started working on a brainfuck compiler for Linux (on IA32). In the tradition of wib, the compiler, named awib, was also written in brainfuck.

The first public release hit the intertubes in early 2004. This first version, while fairly rudimentary, was capable of compiling brainfuck source code into executable ELF binaries. Over the remainder of the year, 3 additional releases were made available. While the first and third of these primarily fixed bugs, the second introduced a form of code optimization. Implementing this feature was a painstaking task and it became evident that major refactoring was needed. Development ground to a halt and it wasn't until three years later that the project was picked up again.

During the summer and fall of 2007, awib was rewritten from scratch. The end result featured improved code optimization and was capable of compiling both to Linux executables and to C code. Much time was invested in making the new code base modular and readable. It should be mentioned that a large part of this was done as a project at the Royal Institute of Technology in Stockholm (project report.)

A priority during the 2007 refactoring was to prepare awib for release as a FOSS project. Since uncommented and raw brainfuck source code is nearly incomprehensible, few programmers would ever be able to contribute to awib. Most of the work done in 2008 served to structure, comment and document the source tree. This culminated in the November 2008 release of awib 0.1 with the full source tree publicly hosted on Google Code.

Awib 0.2 is scheduled for release during the spring of 2010. Stay tuned!