From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id NAA30791; Fri, 6 Jun 2003 13:53:35 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id NAA31100 for ; Fri, 6 Jun 2003 13:53:34 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h56BrYH23048 for ; Fri, 6 Jun 2003 13:53:34 +0200 (MET DST) Received: from santenay.inria.fr (santenay.inria.fr [128.93.8.59]) by pauillac.inria.fr (8.7.6/8.7.3) with SMTP id NAA31150 for ; Fri, 6 Jun 2003 13:53:33 +0200 (MET DST) Date: Fri, 6 Jun 2003 13:53:33 +0200 From: Maxence Guesdon To: caml-list@inria.fr Subject: Re: [Caml-list] Automatic generation of mli files Message-Id: <20030606135333.28df9307.maxence.guesdon@inria.fr> In-Reply-To: <20030606095723.GA8096@kunz.ratzer> References: <20030606095723.GA8096@kunz.ratzer> Organization: INRIA X-Mailer: Sylpheed version 0.8.11claws (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; maxence:01 guesdon:01 caml-list:01 mli:01 ocamlc:01 overwritten:01 experimented:01 ocamldoc:01 outputting:01 ocaml:01 tree:02 wrote:03 exported:03 abstract:03 types:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Fri, 6 Jun 2003 11:57:23 +0200 Stefan Heimann wrote: > Hi, > > I searching for a way for generating the .mli file for a given source .ml > file automatically. My basic idea is like that: > > (1) Specify in the .ml file which values and types should be exported > and if a type should be exported abstract or not. This could be > done with a special comment at the top of the file. > > (2) Filter the output of `ocamlc -i' to exclude the values and types > that should not be exported and to make the types abstract if > needed. > > Of course, the tool should check of there is an existing .mli > file. If the .mli file was not generated by the tool it is not > overwritten. If the list of exported values and types has not changed > the .mli file is not updated too. > > I experimented a little bit with parsing the output of `ocamlc -i' > and printing the modified parse tree. I took must code from the ocaml > distribution. However, I don't think that this is a good way. > > Any ideas of how to implement such a tool? Are there any existing > tools with this functionality? You could develop a custom generator for ocamldoc, outputting an mli file instead of html, latex, ... files. For example, only commented elements would be printed to the generated .mli file, and custom tags could be used to give additional information (abstract types, ...). See the ocamldoc manual for more information about developing custom generators, and feel free to ask me if you encounter difficulties. -- Maxence Guesdon ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners