views:

91

answers:

2

I'm working on a school project where I have to build an interpreter for a simple language using Alex + Happy in Haskell.

After looking through the documentation I understand most of it, but would like to see a full blown example on using the tools.

+4  A: 

Not on building interpreters, but on building lexers and parsers, yes. See the example for a lexical analyzer in Alex, here, combined with an intro to Happy here. I found the haskell.x and haskell.y files distributed in the darcs repos for Alex and Happy useful. You can find those here and here.

Don Stewart
+2  A: 

Haddock has an Alex/Happy parser for documentation, the sources are here in the files Lex.x and Parse.y.

Simon Marlow