Course Software
Ipt
Software
- Start versions for the lab exercises. Updates will appear here, the version is indicated by the date inside the filename. See patches & fixes with the same date for a description of changes.
- Parser combinators, AG system and pretty printing library are installed on the WinXX lab machines. The IPT startversion distribution contains scripts to start Hugs and GHCi.
Additional remarks:
- Simple Stack Machine (SSM) interpreter
- In /praktikum/ipt/SSM (UNIX) or P:\ipt\SSM (WinXX) scripts can be found to start SSM. The .jar Java library for SSM can also be found there. This file will be (silently) updated when new releases for SSM are available.
- There are syntax highlighting modes for UUAG files for the Context and JEdit programming editors.
Patches & fixes
- [Lab exercise 3] The file SLTypeInference for the third lab exercise has the operator "&&" in its initial environment 'initgamma'. However, this will confuse LaTeX, so you may want remove this entry.
Tips and Tricks
If you want to test your own (character) parser, you can copy-paste the following lines into your program.
import UU.Parsing
instance Symbol Char
test :: Show a => Parser Char a -> String -> IO ()
test p input =
do result <- parseIO p input
putStrLn (show result)
Example: The following parser consumes a single 'a' character.
pA :: Parser Char Char
pA = pSym 'a'
Don't forget the type signature here, or the compiler will complain about unresolved top-level overloading. To test
this parser:
MyFile> test pA "abc"
?? Error : at 'b'
?? Expecting : end of file
?? Repaired by: deleting: 'b'
?? Error : at 'c'
?? Expecting : end of file
?? Repaired by: deleting: 'c'
'a'
--
WouterSwierstra - 11 Nov 2004