Archive for April, 2008

Lambda Lifting

Friday, April 4th, 2008

Here is a well-written introductory paper on lambda lifting in Scheme that I just found: http://sciris.shu.edu/masplas2004/MASPLAS%20Papers/Paper%208.pdf. If you are interested in learning about compilers, I think it is a worthwhile paper to read. Lambda lifting is a technique for compiling closures.

In other news, I recently wrote an article at DobbsCodeTalk.com called The Concurrent Future is not Multi-Threaded. I found the discussion interesting.

Rewriting Rules as Axioms for the Compiler

Thursday, April 3rd, 2008

So an interesting problem in compilation is taking advantage of commutativity (or associativity) of functions for reordering instructions. In some cases this can allow a compiler to completely execute something in parallel. So how do you you tell the compiler an operator or function is associative? One obvious option would be to let programmers tag their functions. This is bound to introduce subtle and nasty errors in to the code if the programmer makes a mistake. Not to mention it is inelegant and it isn’t the kind of thing I want to see in people’s code (optimization hints that is).

So the big question is, how do we automatically recognize properties of functions like commutativity? In Cat there is already have a system for expressing rewriting rules (e.g. rule { $a $b f } => { $b $a f } ). This fairly obviously shows us the commutativity of ‘f’. In fact if we can follow any sequence of rewriting rules to arrive at this equality even if it isn’t explicit (which is a simple graph search problem), then we can deduce commutativity.

This indicates to me the usefulness of rewriting systems (like the Haskell rewriting system) that are exposed to the programmer and that guide optimization.

If anyone is familiar with related research please let me know, thanks!

[Follow-up: some interesting discussion on the subject is unfolding at http://lambda-the-ultimate.org/node/2752]

What I am up to right now.

Wednesday, April 2nd, 2008

I currently have several projects on the go. Here is a quick overview of what I am up to:

  • A Cat bytecode interpreter in C in under 12k - Currently it works, but I still want to do more testing before releasing it into the wild
  • The version 1.0 Cat interpreter in C# - I have made some big improvements to the implementation of 0.18.2. The goal is to make it easy for others to integrate in their projects, or to modify. Hopefully it’ll be ready within a week. 
  • I recently wrote an article for DDJ.com on Identifying Top Developers in the Interview Process http://www.ddj.com/architect/207001122 
  • I am working on the Heron specification and adding features to the Heron IDE (not yet ready for public consumption as well).