
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. HTH, Martijn. [1] http://www.haskell.org/haskellwiki/The_Monad.Reader/Issue4/Why_Attribute_Gra... [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