Version franaise
Home About Download Resources Contact us
Browse thread
Extracting a subsignature with comments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: David Rajchenbach-Teller <David.Teller@e...>
Subject: Extracting a subsignature with comments
    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.