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 2E6A9BC48 for ; Mon, 7 Mar 2005 22:40:04 +0100 (CET) Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j27Le3eY007260 for ; Mon, 7 Mar 2005 22:40:03 +0100 Received: from frontend3.messagingengine.com (frontend3.internal [10.202.2.152]) by frontend1.messagingengine.com (Postfix) with ESMTP id 2CB8CC6012A; Mon, 7 Mar 2005 16:40:02 -0500 (EST) X-Sasl-enc: AZI/HXxVuQDor80NBWyKzg 1110231602 Received: from [172.16.112.115] (burnham.ljcrf.edu [192.231.106.2]) by frontend3.messagingengine.com (Postfix) with ESMTP id E72C225599; Mon, 7 Mar 2005 16:40:01 -0500 (EST) Date: Mon, 7 Mar 2005 13:39:57 -0800 (PST) From: Martin Jambon X-X-Sender: martin@localhost To: "Harrison, John R" Cc: caml-list@yquem.inria.fr Subject: RE: [Caml-list] SML->OCaml In-Reply-To: <012676D607FCF54E986746512C22CE7D0312B83E@orsmsx407> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 422CCA33.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 sml:01 violate:01 ocaml's:01 parsing:01 syntax:01 sml:01 bindings:01 lowercase:01 cmi:01 cmi:01 wrote:01 parsed:01 compile:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.2 X-Spam-Level: On Sun, 6 Mar 2005, Harrison, John R wrote: > Does this version do anything about SML programs that violate OCaml's > "uppercase identifier" convention? I recently tried something similar, > and while it did a competent job of parsing most of the syntax of SML, > it just reported errors for SML value bindings starting with an > uppercase letter. It would be nice if it just mapped such names to > "lowercase_XXX" or something so that the result could at least be > compiled. Or is that too "context sensitive" to be easy? [I don't know SML and I am not an expert in Camlp4. And I haven't tried the SML-to-OCaml converter] The converter needs a way to tell whether a given identifier is a type constructor (such as None or Some) or not. Thus the converter needs to remember the accessible type definitions (either from the standard library of SML or from other modules). That is possible, by creating some auxilliary files that contain this information (maybe .cmi files could be parsed but anyway the type definitions have to be analysed during the preprocessing of a file). It doesn't seem to be implemented in pa_sml.ml but a few hundred lines of additional code could do it (or maybe less). There would also be a problem with record fields if several record types use identical names for their fields (using objects is probably not a good idea for simple records). Maybe you could also (1) compile you SML files and (2) use the information contained in the SML equivalent of .cmi files in combination with Camlp4. Martin -- Martin Jambon, PhD Researcher in Structural Bioinformatics since the 20th Century The Burnham Institute http://www.burnham.org San Diego, California