[Haskell-cafe] Writing a compiler in Hakell

Martijn van Steenbergen martijn at van.steenbergen.nl
Wed May 6 03:16:19 EDT 2009

Rouan van Dalen wrote:
> Hi everyone.
> I am designing my own programming language.
> I would like to know what is the best way to go about writing my compiler in haskell.
> What are the tools available in haskell that can help with compiler construction?
> I know about Happy.  Is that a good tool to use?
> The compiler is intended for serious use and I would like it to be very efficient, maybe competing
> with compilers written in C.  It should also be very easy to extend as the languoge grows.

Be sure to take a look at attribute grammars (AG). From what I hear it 
varies whether people like using them, but they're worth a try at least.

The Monad Reader Issue 4 has an introductory article on AGs [1] by 
Wouter Swierstra, explaining what they do and how they are useful. I 
hear Happy has an AG system [2]. Probably the most mature standalone AG 
is the UUAG [3], with which the Utrecht Haskell Compiler [4] was built.



[2] http://www.haskell.org/happy/doc/html/sec-AttributeGrammar.html
[3] http://www.cs.uu.nl/wiki/HUT/AttributeGrammarSystem
[4] http://www.cs.uu.nl/wiki/UHC

More information about the Haskell-Cafe mailing list