caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Extracting a subsignature with comments
@ 2009-03-10 11:39 David Rajchenbach-Teller
  0 siblings, 0 replies; only message in thread
From: David Rajchenbach-Teller @ 2009-03-10 11:39 UTC (permalink / raw)
  To: OCaml

    Dear list,
 After a few experiments based on the indications of Martin Jambon and
Daniel Bünzli, it seems that, to get the correct type signatures for
OCaml Batteries Included, we'll need 
1) either to write the signature of the whole library manually (in
addition to having written the signature of each individual module)
2) or to be able to generate a signature programmatically based the
contents of existing signatures.

If possible, I'd like to take the second approach. For this purpose,
I'll need to be able to analyse a .mli, extract a submodule and produce
a new .mli from that submodule -- while keeping all the comments
involved, to allow further manipulation by ocamldoc.

For instance, in Batteries, we have a file extList.mli, which looks
roughly like:

«

(** Some module comment *)
module List :
sig
    (**The type of lists*)
    type 'a t = 'a list

    (*etc.*)

     (**Some other module comment*)
     module Labels :
     sig
          (*etc.*)
     end
end
»

>From this .mli, I'd like to be able to extract both module List and
module List.Labels.

Extracting module List would produce something along the lines of

«
(** Some module comment *)

(**The type of lists*)
type 'a t = 'a list

(*etc.*)

(**Some other module comment*)
module Labels :
sig
    (*etc.*)
end
»


Extracting module List.Labels would produce something along the lines of

«

(**Some other module comment*)

(*etc.*)

»


Now, that's a long and ingrate task. So here's me, hoping that someone
has already done it for me, or could advise a tool which could help me.
Any suggestion?

Note that Camlp4 does not seem applicable (at least not as of OCaml
3.11) as it doesn't track which comments are associated to which node,
which often causes it to detach a ocamldoc comment from a declaration
and attach it to another one.

Thanks in advance,
 David

-- 
David Teller-Rajchenbach
 Security of Distributed Systems
  http://www.univ-orleans.fr/lifo/Members/David.Teller
   « Ce matin Un crétin A tué un chercheur. » (air connu)
   Latest News of French Research: System being liquidated. Researchers angry.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-10 11:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-10 11:39 Extracting a subsignature with comments David Rajchenbach-Teller

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).