From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id DFD14BC48 for ; Fri, 11 Mar 2005 09:31:48 +0100 (CET) Received: from imag.imag.fr (imag.imag.fr [129.88.30.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j2B8Vmj5002982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 11 Mar 2005 09:31:48 +0100 Received: from moucherotte.imag.fr (moucherotte.imag.fr [129.88.43.82]) by imag.imag.fr (8.13.0/8.13.0) with ESMTP id j2B8VkqG024267; Fri, 11 Mar 2005 09:31:46 +0100 (CET) Received: from moucherotte.imag.fr (localhost [127.0.0.1]) by moucherotte.imag.fr (8.12.10+Sun/8.12.9/ImagV2.1.feuille) with ESMTP id j2B8VkkJ027660; Fri, 11 Mar 2005 09:31:46 +0100 (MET) Received: (from scaife@localhost) by moucherotte.imag.fr (8.12.10+Sun/8.12.9/Submit) id j2B8VkCL027657; Fri, 11 Mar 2005 09:31:46 +0100 (MET) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16945.22385.991680.667020@imag.fr> Date: Fri, 11 Mar 2005 09:31:45 +0100 From: Norman Scaife To: "Andreas Rossberg" Cc: Subject: Re: [Caml-list] SML->OCaml In-Reply-To: <006101c52431$cc45efa0$14b2a8c0@wiko> References: <012676D607FCF54E986746512C22CE7D031B264B@orsmsx407> <006101c52431$cc45efa0$14b2a8c0@wiko> X-Mailer: VM 7.17 under 21.4 (patch 12) "Portable Code" XEmacs Lucid X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-1.6 (imag.imag.fr [129.88.30.1]); Fri, 11 Mar 2005 09:31:46 +0100 (CET) X-IMAG-MailScanner: Found to be clean X-IMAG-MailScanner-Information: Please contact the ISP for more information X-Miltered: at nez-perce with ID 42315774.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 sml:01 trivial:01 model:01 sml:01 compiler:01 ocaml:01 minor:01 ast:01 binary:01 compiler:01 wrote:01 wrote:01 uni-sb:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Hi, >> 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 (http://www.ps.uni-sb.de/hamlet) 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. Regards, Norman Scaife.