The Mini-Haskell Partial Evaluator

I am providing you with a (toy) partial evaluator for a small subset of Haskell. If you are at Chalmers, you will find it in ~rjmh/NewPE/PE; make a directory for your exercises and insert a link to this program. This version is compiled for SPARC machines; if you are using a PC then copy all Haskell source files from that directory and compile them using
hbcmake PE
If you are elsewhere, you will need to download and compile the sources (30K). The binding-time checker (BT.hs) is quite a large module, and you will need to give hbc a larger heap in order to compile it: use hbc -H32M. (The partial evaluator is written in Haskell 1.3, and has been compiled with hbc. Much of it has also been tested under Hugs 1.3.)

The partial evaluator is best invoked by a command of the form

PE M <term 
A Haskell module is read from M.hs, and specialised with respect to an initial call in the file term. The output of the partial evaluator is the specialised initial call, followed by the specialised module. Two flags are recognised: Note that programs compiled by hbc interpret the first flags as flags to the run-time system; `user program' flags such as the two above must be preceded by an empty flag, for example:
PE - -btcheck M <term

The Haskell subset includes:

Binding times are explicitly provided via annotations. In general, static operations are indicated by a '$': The partial evaluator supports partially static structures, but note that dynamic functions, constructors and operators must have purely dynamic arguments and results.

If you just want to try the partial evaluator out, you can run it on our web server.

Last modified: Mon Sep 29 14:32:41 MET DST 1997