[Haskell-cafe] Code generation and optimisation for compiling Haskell

wren ng thornton wren at freegeek.org
Fri Jan 13 04:56:59 CET 2012


On 1/12/12 8:50 PM, Jason Dagit wrote:
> On Tue, Jan 10, 2012 at 9:25 AM, Steve Horne
> <sh006d3592 at blueyonder.co.uk>  wrote:
>
>> Also, what papers should I read? Am I on the right lines with the ones I've
>> mentioned above?
>
> Thomas Schilling gave you a good response with papers so I will give
> you a different perspective on where to look.
>
> Most of the Haskell implementations were written by academics studying
> languages and compilers.  This is good but it also implies that the
> implementors are likely to share biases and assumptions.  I know of
> one Haskell compiler in particular that was written by someone who did
> not know Haskell when starting the project.  The compiler was
> developed to be different than GHC.  That person was John Meacham.  He
> created JHC, a work in progress, so you might want to study his
> compiler and implementation notes as they should provide a different
> perspective on how to tackle Haskell implementation and optimization.
>
> http://repetae.net/computer/jhc/

JHC is also notable as a point of contrast because GHC strives to have a 
uniform representation in order to simplify adding high-level 
optimizations, whereas JHC is especially focused on the low-level 
optimizations obtainable by using non-uniform representations. More and 
more of these representational issues have been creeping into GHC over 
the years, so you should definitely take a look at JHC to get a 
different perspective on the space of possibilities than just those 
illuminated by the trajectory of GHC.

On the other end of things, if your heart lies in the compiler itself 
rather than the generated code per se, you should definitely take a look 
at UHC. We often talk about "Haskell" as if it were a language, when in 
fact it is a family of related languages with subtly different features 
and properties. One of the principal goals of EHC/UHC is to design a 
compiler as a series of small passes in order to better disentangle the 
issues surrounding trying to compile an entire family of languages. They 
also have some novel code for dealing with the parsing end of the 
compiler, which is worth exploring separately from the overall design.

-- 
Live well,
~wren



More information about the Haskell-Cafe mailing list