[MLton-devel] teaching a compiler course using MLton

Suresh Jagannathan suresh@cs.purdue.edu
Wed, 18 Sep 2002 09:50:34 -0500

I'm teaching the graduate compiler course next term, and have been
playing around with the idea of using MLton for the implementation.  People 
here seem enthusiastic about the prospect.  I'm not sure though about how
to structure the project.  I've been thinking about using something akin
to core ML as the source language -- let, letrec, single-argument (curried) 
functions, assignment, and lists, and having students compile this down to a 
virtual machine that could be translated x-86 native code.

I'd rather not have students directly mimic MLton's compilation strategy since  
I think it's sufficiently different/complex to make it infeasible for a 
first-year grad. course.  Instead, I've been thinking of a project along more
classical lines: 

  -- convert source to CPS (A-normal form)
  -- implement 0CFA
  -- flow-directed inlining, uncurrying
  -- closure conversion
  -- simple first-order optimizations -- loop-invariance,  common   
              subexpression, useless argument, ...
  -- code generation

The idea here is that we use the MLton backend for code generation;
students would have to thus write a translation step from the FOL
produced by closure conversion to the MLton virtual machine.  This
would be essentially the same as writing their own backend.fun.

I'm worried though about how feasible this strategy is given the complexity of 
the backend and the detailed assumptions it makes about object layout 
(representations), chunks, etc. 

What do you think?


This SF.NET email is sponsored by: AMD - Your access to the experts
on Hammer Technology! Open Source & Linux Developers, register now
for the AMD Developer Symposium. Code: EX8664
MLton-devel mailing list