Programs from Lecture |
As the course progresses links will be provided to take you to sample programs from class.
If you are running Haskell 7.x (for some value of x), ways of accessing libraries have changed. You will need to import Data.Char rather than just import Char. You can also simplify calls to the library by writing, for example, isAlpha rather than Char.isAlpha. A version of the lexer appropriate for Haskell 7 is here. (You can tell which version of Haskell you are using by typing ghci -version.) If you use this version, change the name of the file to PcfLexer.hs before compiling.
Here is also an environment-based interpreter for PCF.
The last problem of Homework 6 asks you to write an interpreter that also works for let-expressions. A parser that generates these terms is available here.
Sample code in PCF can be found here.
Finally, here is an environment-based interpreter (written by Chris Stone) for a simple functional language that includes exceptions.
Programs from Lecture |