Version française
Home     About     Download     Resources     Contact us    
Browse thread
Tools module for the Standard Lib
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Tom Hawkins <tom@c...>
Subject: Tools module for the Standard Lib
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