[Haskell-cafe] Learning about haskell compilers

Creighton Hogg wchogg at login01.hep.wisc.edu
Wed Dec 21 00:14:22 EST 2005

On Wed, 21 Dec 2005, Bernard Pope wrote:

> On Tue, 2005-12-20 at 16:58 -0800, John Meacham wrote:
> > On Tue, Dec 20, 2005 at 10:36:36AM -0600, Creighton Hogg wrote:
> > > I was wondering where I should get started in learing about 
> > > how to implement a haskell compiler?
> Warning: a whole Haskell compiler is a LOT of work.

Oh I figured it would be, but I'm not really planning on 
implementing all of Haskell 98 by myself.
> Nonetheless there are examples of mostly-single-person compilers and
> interpreters out there, so it is possible to do one on your own. Though
> I don't think reading their source code is necessarily the best way to
> get started. 
> I agree with what John said, especially this:
> > there are various other abstract machines out there, the Lazy Virtual
> > Machine used by Helium described in Daan Leijen's Phd thesis is quite
> > interesting, and might make a better first target than G-machine code.
> If you want to write a compiler,
> targeting LVM is (I believe) the easiest way to get something working.
> You could get the source code for hatchet from him to give you a front
> end.
> Another approach is to write a simple interpreter for a small functional
> language and add features in bit-by-bit, as your enthusiasm dictates.
> That way, you get the satisfaction of having something work early on. If
> you write a compiler it might take weeks or months before it does
> anything interesting. Then you can custom build your language with
> whatever features take your fancy. For instance you can add a better
> record system, or play with meta-programming facilities. I started a
> little project like this a while ago, called baskell, which you can get
> from here:
>    http://www.cs.mu.oz.au/~bjpop/code.html
> It has a rudimentary type checker, and a little REPL interface. Feel
> free to hack it to pieces.

I really like your idea of implementing an interpreter for 
just some kindof functional language.  That sounds like it'd 
be pretty instructive and have less frustration factor than 
a whole compiler.  Thanks!

More information about the Haskell-Cafe mailing list