The Summer Of Code, or Compiler Development for the Masses
I’m very pleased to report that my application for the Google Summer of Code has been accepted! It almost goes without saying to mention that I’ve proposed work on the leading compiler for my language-du-jour: Haskell!
So, what exactly am I working on? Well, I and my mentor, Sean Seefried, think it would be awesome if we could give users of Haskell the ability to extend the compiler with their own code. Of course, they can do this today if they are willing to dig into and try and grok the rather intimidating guts of GHCs 216KLOC codebase, but we’d really like to let you do it without a source checkout of GHC and in a way so that it’s easy to use other peoples extensions too.
How are we going to meet these exacting criteria? The plan is to let people write modules that we can distribute via the existing Cabal packaging/build system infrastructure and load into GHC dynamically! We owe the ability to do this to Don Stewart’s excellent hs-plugins library. I’m also going to rustle up a good chunk of documentation and sample code to make it easy as pie to get into development.
This is going to give the Haskell community a whole new way in which to extend the language: I’m very excited to see what they come up with! However, here are just a taste of some of the more reasonable things I think our plugins are going to be able to do:
-
Selectively make Haskell a strict functional programming language
-
Optimize your code in whatever application-specific way you can come up with
-
Declaratively memoize arbitrary function definitions
-
Compile Haskell code to run on GPUs if available
-
Simple empirical research on functional programming by letting you write code analysis extensions
-
Cure world hunger
OK, that last one might be a bit optimistic, but I’m still very excited about the possibilities :-).
What’s more, although nothing is certain, it looks like come October I’ll be working here at the Cambridge Computer Lab as a PhD student! I’ve proposed to investigate some aspects of parallelism in functional programming - more on this as it unfolds. I’ve just got to worry about getting a first in my finals - which are only a month or so away! Gah!
Congratulations! All sounds like fun. :-)
Would it be possible to write an extension for GHC with the system you're proposing which would give GHC the capability to target the JVM or Parrot?
John,
I'm afraid not! I'm only proposing to augment the so-called "middle end" of GHC. If you wanted to change the code generation part of GHC, you would need to be able to replace the "back end" of GHC.
This summer, Microsoft Research are sponsoring an intern to thoroughly overhaul GHCs code generation, so it wouldn't be helpful to begin writing a plugins system for that part of the compiler at this point even if there was demand for one. The improvements that result from this overhaul should also mitigate some of the current concerns about GHCs code generation and hence reduce the need to replace the back end anyway.
If you are interested in porting GHC to a new platform you can of course still do it by contributing a backend. If you were looking at a simple port to a new processor you could start here: http://hackage.haskell.org/trac/ghc/wiki/Building/Porting