Archive for December, 2010

Continuation Passing Style

December 25, 2010

My iPhone project will grab all of my time for the next two to three weeks before I can continue with my Android/Babel-17 project. Once the iPhone project is done, Babel-17 will be back with a vengeance! The plan is to introduce a new intermediate representation CPS for Babel-17 programs. CPS stands for “continuation-passing style” and there will be a translator from the current representation (lets call it B17) to CPS. This translator handles features of Babel-17 like pattern matching, linear scope, tail recursion.

The advantage of the CPS representation is that it is much closer to the metal than B17. Therefore CPS is the ideal starting point for different code generator backends. Code generators for Java, Javascript, LLVM etc. just need to understand CPS as their input. It will therefore be easy to let Babel-17 target a new platform, as the substantial work of parsing a Babel-17 program into a B17 representation, checking a program in B17 form and translating a B17 program into a CPS program will have already been done.

In Bed With Assange

December 19, 2010

So, let’s take a look at what there was to read about Assange and the rape accusations against him.

1) Famous Assange meets (probably pretty) woman who invites him into her home. Somehow they end up in bed discussing the use of condoms. Then Assange forces himself onto the woman.

2) Famous Assange meets (probably pretty) woman who invites him into her home. Somehow they end up in bed together, spending the night there. After breakfast, they go back to bed. Then Assange forces himself onto the woman (while she sleeps).

I guess I can see a pattern here. Of course Assange is guilty, and of course I have not the slightest bit of pity for the women.

EDIT: There is an interesting discussion about this between Naomi Wolf and Jaqueline Friedman. I do not agree completely with any of them.

System library of Babel-17

December 13, 2010

Part of Babel-17 is already written in Babel-17. There are around 200 lines of Babel-17 collected in the system library of Babel-17 which are used to implement messages to objects of built-in types. For example, Babel-17 translates the code

c.take n

where c is an object of type list, vector, set or map into a call

coll_take c n

of the system library function coll_take, where coll_take has the following implementation:

Writing as much code as possible of the library in Babel-17 itself makes its implementation more portable and also easier to understand, because all issues relating to concurrency, laziness, exceptions etc. are dealt with automatically.

Above code is also a good starting point to learn Babel-17. It employs many important concepts and language constructs. When you fully understand above example, you are well on your road to become a Babel-17 expert. It also employs the try … catch expression which is new and has not been available in v0.21 . The code

  case p1 => b1
  case pn => bn

is similar in meaning to

case (exception p1) =>  b1
case (exception pn) =>  bn
case v => v

The main difference between above two code fragments is that in the try-version, the argument b is a statement which can participate in linear scope. The argument of match is a simple expression, though, and therefore there are no variables in linear scope.

Babel-17 v0.21

December 10, 2010

Finally. It’s here. Check it out at .

Babel-17 Netbeans Plugin

December 6, 2010

A first version of the Babel-17 Netbeans Plugin has been completed.

Edit: Where is the error in the above picture 🙂

Being a first version, it is nothing fancy, but has the most important ingredients:

– syntax highlighting

– error highlighting

– the ability to run a program

– the ability to jump from stacktraces to locations in the source code

Currently the feature is missing to stop a program that has gone rogue… you will have to use the “kill” command for that right now. It will become part of the plugin as soon as possible, because it annoys me a lot!

Before I release it, I need to add the standard library to the interpreter and update the spec. The current spec you can download from “Downloads” at is from July and outdated in certain places. A more up-to-date spec can be found in the Babel17_Docs directory.

Scheduled release date for the plugin is the coming Friday.

Year 1 of phlegmatic programming

December 3, 2010

I started this blog pretty much one year ago, declaring it “year 0 of phlegmatic programming”. One year has gone by now, and Babel-17 v0.21 is almost here. What’s missing? Not much:

  1. Right now there are two parts, one written in Java, and one in Scala. I need to merge the error messages from both parts into one log of error messages. Estimated effort: 1-3 hours.
  2. There is no debugger, and it is doubtful if I will ever provide one, as I have no need for one. What is more important is to be able to examine exception traces. Every exception in Babel-17 should therefore be able to print its exception trace to the log. Estimated effort: 1 day.
  3. A language feels much more real, if you have a nice editor for it. There will be a Netbeans plugin for editing Babel-17 files which has syntax and error coloring. It would also be nice to directly run Babel-17 from Netbeans, but for Babel-17 v0.21 I will provide this only if I see how this can be done quickly. Estimated effort: 1 day.
  4. Although the basic features of the language have been implemented, some of the operations on standard types like maps have not been implemented yet. Estimated effort: 1 to 3 day.
  5. Finally, update the spec so that the spec fits the current implementation.

So hopefully, after this weekend I have a complete version except for parts of the standard library. By the end of next week, Babel-17 v0.21 should be available. Check back on Monday for the newest progress report.