caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <martin_jambon@emailuser.net>
To: "Harrison, John R" <johnh@ichips.intel.com>
Cc: caml-list@yquem.inria.fr
Subject: RE: [Caml-list] SML->OCaml
Date: Mon, 7 Mar 2005 13:39:57 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0503071308440.2011-100000@localhost> (raw)
In-Reply-To: <012676D607FCF54E986746512C22CE7D0312B83E@orsmsx407>

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





  reply	other threads:[~2005-03-07 21:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-07  2:14 Harrison, John R
2005-03-07 21:39 ` Martin Jambon [this message]
2005-03-08  9:11   ` Andreas Rossberg
2005-03-08 20:46     ` AST traversal functions (was: SML->OCaml) Martin Jambon
2005-03-08 21:00       ` [Caml-list] " Hal Daume III
  -- strict thread matches above, loose matches on Subject: below --
2005-03-08 18:17 [Caml-list] SML->OCaml Harrison, John R
2005-03-08 22:54 ` Andreas Rossberg
2005-03-11  8:31   ` Norman Scaife
2005-03-06 20:03 SML->OCaml Konstantine Arkoudas
2005-03-06 22:15 ` [Caml-list] SML->OCaml Martin Jambon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0503071308440.2011-100000@localhost \
    --to=martin_jambon@emailuser.net \
    --cc=caml-list@yquem.inria.fr \
    --cc=johnh@ichips.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).