[MLton] Welcome to Dan Wang
Matthew Fluet
fluet@cs.cornell.edu
Wed, 3 Mar 2004 14:03:08 -0500 (EST)
> Welcome to Dan Wang, who has joined the MLton list. He is generally
> interested in following the discussion, and is also interested in
> porting the latest version of CM (which has supposedly been designed
> to be more compiler agnostic) to MLton to use as a batch compilation
> system for MLton.
Dan, I've got some patches to SML/NJ and MLton's cmcat that might be
useful in this context. CM.Graph.graph (used by cmcat) seems to always
fail on a stabilized library -- which probably makes sense, as a
stabilized library may well be delivered without source. However, this
was giving me problems when I wanted to extract a file list from a .cm
files that references $/smlnj-lib.cm (or any other stabilized SML/NJ
library). The other issue is that CM.Graph.graph returns imports without
accompanying anchor environments.
In any case, with these patches, I can use cmcat to extract source file
lists from most SML/NJ CM projects without modifying the .cm files. (A
.cmcat-pathconfig is used to reassociate anchors from the stable libraries
to the source locations.) I was able to successfully use this to port
John Reppy's Moby compiler and ML-Doc (including your mkdoc tool, which
requires using the SML/NJ front-end).
On a lark, I've tried running cmcat on it's own .cm file (which entails
pulling in most of CM). I get all the right source files, but of course
there are some primitive things that CM is assuming (and the SML/NJ
runtime provides), which aren't there when MLton is compiling the sources.
That would seem to be the point where a proxy for MLton or some
reorganization of the SML/NJ sources would be required.