Uhc Previously

Ehc

This is the old and obsolete page for UHC, the Utrecht Haskell Compiler. Don't rely on the content...

UHC is, as indicated by the name, a Haskell Compiler, though still in its infancy. As such, the compiler does type inferencing but does not generate executable code. Development for UHC focusses on the more intricate parts of type inferencing thereby providing additional features on top of those from Haskell itself.

  • Existential types
  • Quantifiers for universal and existential type may occur at any place in a type
  • Locations for unspecified quantifiers (in an explicit type) are inferred

UHC is (currently) used as part of a course on Type Systems where participants do small projects where new type related features are designed and implemented. The seminar Implementation of UHC focusses more on its implementation. This seminar also helps students to prepare for a masters thesis in the area of compiler building and language design.

UHC grew out of the micro compiler used in the course Implementation of Programming Languages. An out of date, previous page on this project still exists.

Design starting points

  • Haskell originally has been designed such that a programmer need not specify any type. All types are inferenced. In practice, this turns out to be a hindrance for the programmer, difficult to implement and cripple the language. Therefore, in UHC type inference is kept simple and features as orthogonal as possible; type annotations are used by the programmer to specifiy difficult to inference properties (types) of a program.
  • The description of the implementation should be as simple and understandable as possible. Though it may be self-evident that this starting point is in contradiction with the previous one, we hope to achieve this by the right choice of specification languages, currently Attribute Grammar + Haskell + combinator libraries for parsing and pretty printing. In this way, the compiler can be used for educational as well as research purposes.

Student projects

As part of the work towards a full blown Haskell++ compiler the following projects can be done (similar to/taken from the topics from Type Systems and Implementation of UHC).

Topic Description Assigned to Supervised by
Code generation (for lvm) LVM (Lazy Virtual Machine) is a portably runtime system suitable for executing functional programs. It has been made by DaanLeijen.    
Uniqueness types In a functional language like Haskell values in general are computed once, immutable and can be shared. This convenience comes at a price in terms of execution costs. However, if for a value it is known that sharing is not required (then said to be used uniquely used) more efficient code can be generated.    
Helium quality error reporting Helium is a Haskell compiler for use by beginning Haskell programmers. As such it provides less language features but better error reporting. This project investigates if and how the techniques used in Helium can be used in UHC with its richer set of features.    
Extendible records   ErikKnoop ArthurBaars, AtzeDijkstra
AG system in UHC Attribute Grammars allow a programmer to independently specify independent aspects of some data structure, usually a tree. Usually this is done in a separate attribution language which is then compiled into another target language. This generative nature often inhibits profiting from features of both (i.e. attribution & target) languages or duplicates functionality. This project aims at integrating an attribution language with UHC.    
Generics in UHC      
Module system      
Ordering of attribute computation in AG system      
Memoization, function caching in lvm      

Missing Haskell features

Apart from the ++ part of UHC becoming a Haskell++ compiler a lot of issues still have to be added to make UHC compatible with Haskell. However, most of the Haskell syntax is currently accepted.

Download & use

UHC is available from the CVS archive as part of the UUST library:
cvs -d :pserver:anonymous@cvs.cs.uu.nl:/data/cvs-rep login
cvs -d :pserver:anonymous@cvs.cs.uu.nl:/data/cvs-rep checkout uust

The INSTALL.html file contains more information about how to build the library, the following is an excerpt plus additional commands to build the development version of UHC. The top of the UUST library is labeled UUST_ROOT in the following

cd UUST_ROOT # if not already there
./configure
make
cd tools/hc/dev
make devel

The compiler is named 'uhcd', built by GHC (version 5.04 or higher) if GHC is available, the build result can be found in UUST_ROOT/build/bin. If GHC is not avaible the Hugs version 'uhcdh' can be used. Test examples are in the subdirectory 'test-src':

cd test-src
UUST_ROOT/build/bin/uhcd -t <file.sl>

-- AtzeDijkstra - 10 Jun 2003

-- AtzeDijkstra - 24 Nov 2006