Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: [Caml-list] SML->OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-03-11 (08:31)
From: Norman Scaife <Norman.Scaife@i...>
Subject: Re: [Caml-list] SML->OCaml

    >> Can you recommend any SML frontend that I could, more or less trivially,
    >> use to systematically munge uppercase identifier names and spit out the
    >> program again?

    Andreas> Nothing I'd dare to call trivial. If you don't mind the plug, I
    Andreas> wrote a model interpreter for SML (
    Andreas> that has been tuned for readability and modularity and ripping off
    Andreas> binding analysis should be easier than with any other compiler. It
    Andreas> still won't be one hour's task to make such a tool from it,
    Andreas> particularly if you want to maintain the layout of the original
    Andreas> program. But I don't know anything simpler either.

I'm not sure if this is of any help but about 9 (sic) years ago I
wrote a translator for SML to OCaml based on the MK Kit (Version
2). It was intended to provide smaller binaries for SML programs on
(then limited-memory) parallel machines. It is not source-to-source,
in fact it generates Core SML in OCaml form with some minor cosmetic
transformations on the output (eg. ((op ::) (1,((op ::) (2,nil)))) ==>
[1,2]). I've sort of thought about converting it into Hamlet (which I
believe was originally based on the ML Kit) but that's too
daunting. However, If anybody wants to tackle the problem I could send
the AST traversal code (about 2000 lines SML for decs, 700 lines for
topdecs). This is old code, however, and is not too clever with some
aspects of the translation, for instance records are not properly
converted. Alternatively, I can generate a binary for just the
translator (it's part of a transformational compiler) but this adds a
whole load of extra "junk" to the output, for instance it bootstraps
the SML prelude on the OCaml side. It also needs a whole load of
support files such as the type signatures of SML Basis functions.

Norman Scaife.