[Haskell-cafe] Somewhat random history question

ajb at spamcop.net ajb at spamcop.net
Sun Nov 11 04:31:32 EST 2007

G'day all.

Quoting Felipe Lessa <felipe.lessa at gmail.com>:

> But I can't say what was the particular method used by GHC.

I don't either, but here's a suggested plan of attack:

1. Write a parser for a suitable subset of Haskell, in a closely
related language (e.g. Miranda).

2. Write a front-end that translates the subset of Haskell into Miranda.
(Because the languages are so close, this is straightforward, if the
subset is chosen well.)

(Note: You now effectively have a working implementation of a subset of
Haskell, since you can reuse Miranda's typechecker and run-time environment.
However, it's written in Miranda.)

3. Now start writing a simple Haskell compiler in the subset of Haskell
that you have, using the implementation to do the heavy lifting.  You
can use other external tools as part of the compilation process, too
(e.g. C compiler, Perl script, whatever).  Keep going until the simple
compiler can compile the implementation.

4. Test.  A lot.  When you're satisfoed, you have successfully
bootstrapped, and can ditch your reliance on Miranda.

5. Implement a larger subset of Haskell.  Test, rinse and repeat.

Andrew Bromage

More information about the Haskell-Cafe mailing list