🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: fa.caml
Article #49

Re: [Caml-list] automatic extaction of the .mli (and a little more) from the .ml

#49
From: Alain Frisch
Date: Mon, 03 Jun 2013 17:12
47 lines
4466 bytes
I've created a proof-of-concept implementation of such a tool as part of 
the "extension_points" branch, which introduces a syntax for attributes 
on various syntactic items (including type declarations and value bindings).

Note that I *don't* endorse the idea of generating .mli files 
automatically :-)


Here is the code:

http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/nomli.ml?revision=HEAD&view=markup

and an example:

http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/test_nomli.ml?revision=HEAD&view=markup


On 05/31/2013 05:43 AM, Francois Berenger wrote:
> - I think there should be tags in the .ml file as comments
>    that say "export this" to the .mli.

Encoding annotations in comments is very fragile, because they are not 
kept by the parser in the generated Parsetree, and it is not 
well-defined to which component each component refers to.  ocamldoc uses 
comments, and as a consequence, it does not combine well with 
preprocessors (Camlp4/Camlp5/Fan/ppx extensions cannot generate 
documentation fragments, and it is likely that they break existing 
ones).  A version of ocamldoc based on attributes of the 
extension_points branch would be much more robust (and simple).  I've 
written another toy POC implementation of a mini-ocamldoc based on 
attributes:

http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/minidoc.ml?revision=HEAD&view=markup

http://caml.inria.fr/cgi-bin/viewvc.cgi/ocaml/branches/extension_points/experimental/frisch/testdoc.mli?revision=HEAD&view=markup


(experimental/frisch/Makefile in the extenstion_point branch contains 
everything to compile and run these little demos.)

-- Alain

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs
Technical Details
Message-ID: <fa.oq1U2ELkNYjo+l/xWiLVHjNZ/Ik@ifi.uio.no>
Path: arc1-ca.pugleaf.net!bp1ni34404pbd.1!nntp.google.com!news.glorb.com!uio.no!nntp.uio.no!.POSTED!not-for-mail
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no>

Show Full Headers
Complete Article Headers
X-Google-Thread: c0fe4b917e,bcac4a6e27ff55dd,start
X-Google-Attributes: gidc0fe4b917e,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
X-Received: by 10.66.51.138 with SMTP id k10mr4014350pao.40.1370279541268;
        Mon, 03 Jun 2013 10:12:21 -0700 (PDT)
Path: arc1-ca.pugleaf.net!bp1ni34404pbd.1!nntp.google.com!news.glorb.com!uio.no!nntp.uio.no!.POSTED!not-for-mail
From: Alain Frisch <alain@frisch.fr>
Newsgroups: fa.caml
Subject: Re: [Caml-list] automatic extaction of the .mli (and a little more)
 from the .ml
Date: Mon, 03 Jun 2013 17:12:20 UTC
Organization: Internet mailing list
Lines: 47
Sender: caml-list-request@inria.fr
Message-ID: <fa.oq1U2ELkNYjo+l/xWiLVHjNZ/Ik@ifi.uio.no>
References: <fa.ysPYFL5+u0NnfGu8UBtNleD9SeQ@ifi.uio.no>
NNTP-Posting-Host: mail-jess.uio.no
Mime-Version: 1.0
X-Trace: readme.uio.no 1370279540 5113 129.240.7.9 (3 Jun 2013 17:12:20 GMT)
X-Complaints-To: abuse@uio.no
NNTP-Posting-Date: Mon, 3 Jun 2013 17:12:20 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:22.0) Gecko/20100101 Thunderbird/22.0
To: Francois Berenger <berenger@riken.jp>, caml-list <caml-list@inria.fr>
X-IronPort-AV: E=Sophos;i="4.87,794,1363129200"; 
   d="scan'208";a="20127875"
X-Original-To: caml-list@sympa.inria.fr
Delivered-To: caml-list@sympa.inria.fr
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: AoIAAF/NrFHB/BfSlGdsb2JhbABZgzm/BYEZDgEBAQEJCwkJFAMlgiMBAQU4QBELGAkWDwkDAgECAUUGAQwIAQGIDQi8BI8ug1gDlz6BKYR1jHqBOQ
X-IPAS-Result: AoIAAF/NrFHB/BfSlGdsb2JhbABZgzm/BYEZDgEBAQEJCwkJFAMlgiMBAQU4QBELGAkWDwkDAgECAUUGAQwIAQGIDQi8BI8ug1gDlz6BKYR1jHqBOQ
X-IronPort-AV: E=Sophos;i="4.87,794,1363129200"; 
   d="scan'208";a="16614838"
In-Reply-To: <51A81C67.50902@riken.jp>
X-Sequence: 6876
X-no-archive: yes
List-Id: <caml-list.inria.fr>
List-Archive: <http://sympa.inria.fr/sympa/arc/caml-list>
List-Help: <mailto:sympa_inria@inria.fr?subject=help>
List-Owner: <mailto:caml-list-request@inria.fr>
List-Post: <mailto:caml-list@inria.fr>
List-Subscribe: <mailto:sympa_inria@inria.fr?subject=subscribe%20caml-list>
List-Unsubscribe: <mailto:sympa_inria@inria.fr?subject=unsubscribe%20caml-list>
Original-Date: Mon, 03 Jun 2013 19:12:10 +0200
Original-Message-Id: <51ACCE6A.7050704@frisch.fr>
Original-References: <51A81C67.50902@riken.jp>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit