CS 453 Recitation — 15 minute compiler in Haskell

This recitation has been adapted from a recitation where we used to create a compiler in 15 minutes by using code generation tools. However, since the lexer and parser for the example compiler are now written by hand, the "15 minutes" does not hold anymore. Therefore, you will be downloading the completed lexer and parser for the 15 minute compiler example and playing around with it in various ways.

For this recitation, do the following:

  1. Download Main15min.hs, Lexer15min.hs, infile, and README.
  2. Build and run the compiler on the example infile.
  3. Play with the triangle so that it becomes a hat for Mickey by editing Main15min.hs.
  4. Modify the grammar of the little language so that the Triangle can be parameterized however you would like.
  5. (Optional) Note the repetition of code in parseProgram and parseStmts. Can you figure out a more succinct way to write this in Haskell?

mstrout@cs.colostate.edu .... February 12, 2015