[Mr Happy]

The Parser Generator for Haskell


What is Happy?

Happy is a parser generator system for Haskell, similar to the tool `yacc' for C. Like `yacc', it takes a file containing an annotated BNF specification of a grammar and produces a Haskell module containing a parser for the grammar.

Happy is flexible: you can have several Happy parsers in the same program, and several entry points to a single grammar. Happy can work in conjunction with a lexical analyser supplied by the user (either hand-written or generated by another program), or it can parse a stream of characters directly (but this isn't practical in most cases).

As of version 1.5, Happy is capable of parsing full Haskell. We have a Haskell parser that uses Happy, which will shortly be part of the library collection distributed with GHC.

Downloading Happy

Happy is part of the Haskell Platform, so if you install the platform you will automatically have a working Happy.

Happy is also on Hackage. If you have the cabal-install tool (which also comes with the Haskell Platform), then you can build and install the latest version of Happy with

  cabal install happy

To find out what the latest version of Happy is, and to download the source separately, go to Happy's HackageDB page.

Happy might also be pre-packaged for your OS:


Happy is licensed under a BSD-style license. The current sources are in a Darcs repository, to get the latest version say:

   darcs get http://darcs.haskell.org/happy/

Feel free to hack on Happy and darcs send me your patches.


Happy versions up to 0.9 were written by Andy Gill and Simon Marlow.

All improvements since 0.9 are by Simon Marlow (and various other contributors).


A big thanks to Ben Jones for loaning out his copy of the Roger Hargreaves Mr Happy book.

Simon Marlow, marlowsd@gmail.com