caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Hal Daume III <hdaume@ISI.EDU>
To: Martin Jambon <martin_jambon@emailuser.net>
Cc: Andreas Rossberg <AndreasRossberg@web.de>, <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] AST traversal functions (was: SML->OCaml)
Date: Tue, 8 Mar 2005 13:00:55 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.44.0503081257000.10456-100000@albini.isi.edu> (raw)
In-Reply-To: <Pine.LNX.4.44.0503081209240.1306-100000@localhost>

> It just requires a good root-to-leaves substitution function which does
> not ask us to match explicitely every kind of node of a given type (which
> is extremely repetitive and error-prone, even with quotations). I already
> thought of doing this (actually automatically deriving such a higher-order
> function from the type definition of the AST: Pcaml.expr and friends).
>
> This would let us focus only on the specific cases such as "open",
> "let ... in", "fun ...", "let ..." (or "val ..."), simple identifiers and
> module-related issues.

FWIW, this is exactly what the "scrap your boilerplate" proposal in 
Haskell does.  I've used it to do something relatively similar: converting 
multiple Haskell modules into one large module.  The brunt of the work is 
basically in replacing identifiers with something unique, and is more or 
less the same as the problem you're talking about here.  The code for the 
traversal is about 300 lines, compared to the several thousands of which 
would be required to match every constructor.

-- 
 Hal Daume III                                   | hdaume@isi.edu
 "Arrest this man, he talks in maths."           | www.isi.edu/~hdaume


      reply	other threads:[~2005-03-08 21:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-07  2:14 [Caml-list] SML->OCaml Harrison, John R
2005-03-07 21:39 ` Martin Jambon
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       ` Hal Daume III [this message]

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.0503081257000.10456-100000@albini.isi.edu \
    --to=hdaume@isi.edu \
    --cc=AndreasRossberg@web.de \
    --cc=caml-list@yquem.inria.fr \
    --cc=martin_jambon@emailuser.net \
    /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).