Version française
Home     About     Download     Resources     Contact us    
Browse thread
Scripting in ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Aleksey Nogin <nogin@m...>
Subject: Re: [Caml-list] Scripting in ocaml
On 26.12.2006 15:36, Ian Zimmerman wrote:

> On 12/26/06, Aleksey Nogin <nogin@metaprl.org> wrote:
> 
>> Not quite scripting in OCaml, but related - the OMake build system comes
>> with its own shell interpreter - osh. The language is not OCaml, but
>> it's a functional language that was _specifically_ designed as a
>> scripting language, so I would argue that writing scripts in osh is more
>> convenient that scripting in OCaml (although, of course, for somebody
>> already familiar with OCaml, learning osh might be a bit harder that
>> learning some hypothetical scripting extension of OCaml).
>>
>> Note that if the goal is specifically "scripts to perform various build-
>> and development-related tasks" as you've mentioned, then I would
>> definitely suggest looking at OMake and osh - there the scripting
>> language is the same as the build specification language and you can
>> inline osh scriplets directly into "make-style" build rules of OMake.
> 
> Does it handle building in general, or just OCaml-based projects?  For
> example, can it deduce header dependencies for a C file - possibly with a
> plugin, like cons or scons? 

Yes, definitely. OMake is meant to be language-agnostic. It comes with
standard libraries for OCaml (including support for preprocessors, for
ocamlfind and experimental support for the Menhir parser-generator), C,
C++ and LaTeX, including appropriate dependency scanning rules for there
languages and support for projects that have a mixture of these
languages. It should be fairly straightforward to add support for other
languages as well (for example, recently Dirk Heinrichs had written an
experimental Ada module).

To rehash from http://omake.metaprl.org/, OMake is designed for
scalability and portability and its features include:

- Support for projects spanning several directories or directory
hierarchies.

- Fast, reliable, automated, scriptable dependency analysis using MD5
digests, with full support for incremental builds.

- Fully scriptable, includes a library that providing support for
standard tasks in C, C++, OCaml, and LaTeX projects, or a mixture thereof.

For small projects, a configuration file may be as simple as a single line

   .DEFAULT: $(CProgram prog, foo bar baz)

which states that the program "prog" is built from the files foo.c,
bar.c, and baz.c. This one line will also invoke the default standard
library scripts for discovering implicit dependencies in C files (such
as dependencies on included header files).

- Full native support for rules that build several files at once.

- Portability: omake provides a uniform interface on Linux/Unix
(including 64-bit architectures), Win32, Cygwin, Mac OS X, and other
platforms that are supported by OCaml.

- Built-in functions that provide the most common features of programs
like grep, sed, and awk. These are especially useful on Win32.

- Active filesystem monitoring, where the build automatically restarts
whenever you modify a source file. This can be very useful during the
edit/compile cycle.

- A built-in command-interpreter osh that can be used interactively.

Aleksey