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 42961BC51 for ; Sun, 5 Dec 2004 21:24:49 +0100 (CET) Received: from services.cse.ucsc.edu (services.cse.ucsc.edu [128.114.48.10]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iB5KOkZx002051 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Sun, 5 Dec 2004 21:24:48 +0100 Received: from localhost (kresge-37-234.resnet.ucsc.edu [169.233.37.234]) (authenticated bits=0) by services.cse.ucsc.edu (8.13.1/8.13.1) with ESMTP id iB5KOf3h019351 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Sun, 5 Dec 2004 12:24:43 -0800 (PST) Date: Sun, 5 Dec 2004 12:23:47 -0800 From: Kenneth Knowles To: Tom Hawkins Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Tools module for the Standard Lib Message-ID: <20041205202346.GA21394@tallman.ucsc.edu> References: <41B34705.4000207@confluent.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41B34705.4000207@confluent.org> User-Agent: Mutt/1.5.6i X-Miltered: at concorde with ID 41B36E8E.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 lib:01 wrote:01 ocaml:01 ocaml:01 lexers:01 parsers:01 makefile:01 high-level:01 o'caml:01 fixpoint:01 iteration:01 fixpoint:01 ocamlc:01 ocamlopt:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: On Sun, Dec 05, 2004 at 11:36:05AM -0600, Tom Hawkins wrote: > 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. I did a similar thing with ocamlconf (currently don't have time to maintain it, though), except it generates a Makefile from a high-level spec. I think getting the "make" logic into O'Caml is the right way to go, and it'll make it easier to experiment with different build strategies, such as the fixpoint iteration Skaller has brought up, or some constraint->action (a la Dijkstra's guarded commands) approach that would subsume fixpoint and traditional make. > 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: Sounds like a polyvalent program: http://www.catb.org/~esr/writings/taoup/html/ch11s07.html#id2960228 I think this is an admirably flexible way to design tools of all sorts, but it might force too much stability on the compiler's internals. A user could implement this module using tempfiles and storing whole file contents in memory.. actually I guess there'd be a problem parsing reasonable exceptions from the error messages... - Kenn p.s. As far as the details, I think "*_of_filename" functions are misguided, and "*_of_channel" is more appropriate.