From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id BCFEFBC51 for ; Sun, 5 Dec 2004 17:39:16 +0100 (CET) Received: from fuzzy.phpwebhosting.com (194.67-19-13.reverse.theplanet.com [67.19.13.194] (may be forged)) by concorde.inria.fr (8.13.0/8.13.0) with SMTP id iB5GdFFv006798 for ; Sun, 5 Dec 2004 17:39:16 +0100 Received: (qmail 23872 invoked from network); 5 Dec 2004 16:29:45 -0000 Received: from unknown (HELO ?192.168.0.4?) (65.30.237.159) by 194.67-19-13.reverse.theplanet.com with SMTP; 5 Dec 2004 16:29:45 -0000 Message-ID: <41B34705.4000207@confluent.org> Date: Sun, 05 Dec 2004 11:36:05 -0600 From: Tom Hawkins User-Agent: Mozilla Thunderbird 0.8 (X11/20041010) X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Tools module for the Standard Lib X-Enigmail-Version: 0.86.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 41B339B3.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; lib:01 ocaml:01 ocaml:01 lexers:01 parsers:01 ocamlc:01 ocamlopt:01 ocamllex:01 ocamlyacc:01 ocamldep:01 mli:01 mll:01 cmx:01 encapsulated:01 ...:98 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.0 X-Spam-Level: Recently I've been reorganizing my build process for Confluence -- it's a hardware design language implemented in OCaml. A few days ago a Confluence user made an interesting suggestion: why not use OCaml to build OCaml applications? He then proceeded to write an OCaml script to generate the lexers and parsers, compile the interfaces and implementations, then link everything together. Extrapolating on this idea, it would be advantageous to have a "Tools" module in the standard library to provide an interface to ocamlc, ocamlopt, ocamllex, ocamlyacc, ocamldep, and all the other tools. Such a module would provide first-class ADTs for data that is currently represented in files: .ml, .mli, .mll, .cmi, .cmx, etc. For example: let my_ml = Tools.ml_of_file "my.ml" in (* or ... *) let gen_ml = Tools.ml_of_string "print_string \"hello!\"" in With such a framework, the complexity of the build process is encapsulated in a program. After your process is complete, write out the final executable: Tools.output_exe some_channel my_compiled_application Just an idea. -Tom