[MLton] How easy is it to steal MLton's front end?
Stephen Weeks
MLton@mlton.org
Wed, 21 Jul 2004 10:32:57 -0700
> Has anyone successfully stolen MLton's front end to use with another
> back end?
Not really. The only slightly related uses I am aware of are Simon
Helsen's use of a very old MLton for a partial evaluator (MLOPE) and
Dan Wang's use for a type-preserving GC. Simon's stuff hooked into
our Xml IL and Dan's hooked into the Ssa IL (at the time it was called
Cps).
> The input that I need is a defunctionalized, explicitly-typed,
> monomorphic lambda calculus with sums, products, and some reasonable
> base types.
The overall compiler structure is in main/compile.fun. Here are the
some ILs corresponding to various passes.
transformation output IL
--------------- ---------
defunctorization CoreML
monomorphisation Sxml
defunctionalization Ssa
> Given that MLton defunctionalizes higher-order functions, and used to
> and may still clone functions for monomorphization,
Yes, MLton still does this.
It looks like you want to hook into the Ssa IL. I don't know if you'd
call it a lambda calculus, but it certainly meets all your other
requirements (defunctionalized, explicitly typed, monomorphic with
sums, products, and base types). Have a look at
mlton/ssa/ssa-tree.sig in our sources for a description of the IL.
You may want to read it bottom up for a top-down overview.