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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin.jambon@e...>
Subject: ocamlscript 2.0.0
ocamlscript version 2.0.0 was just released. It is considered stable, and
there is no big change since the previous release 1.99.5 except for the
packaging and the web page:

  http://martin.jambon.free.fr/ocamlscript.html

Ocamlscript 2 derives from David Mentre's original implementation and adds
support for findlib packages, camlp4 syntax extensions, ocamllex,
ocamllyacc, input from stdin, script on the command-line, and some support
for compilation and linking with other source files. In theory it can also
be configured to support any compiled programming language other than
OCaml.


Description:
===========

ocamlscript compiles scripts, i.e. one-file programs, into
natively-compiled binaries, and executes them.

Basically, a script named alpha is compiled into alpha.exe. If alpha.exe
is more recent than alpha, then alpha.exe is executed directly, otherwise
alpha is recompiled first.

Compilation commands reside in the first section of the script. They are
written in OCaml and consist normally in setting one or two variables.


Example:
========

The following "getpage" script fetches a web page using the HTTP client
provided by the netclient library/findlib package:

#! /usr/bin/env ocamlscript
Ocaml.packs := [ "netclient" ]
--
match Sys.argv with
    [| _; url |] -> print_string (Http_client.Convenience.http_get url)
  | _ -> prerr_string "Usage: getpage URL\n"; exit 1

For instance, executing "getpage http://caml.inria.fr" creates a
getpage.exe file in the same directory as "getpage", runs it and prints
the web page that was requested.



Martin

--
Martin Jambon
http://martin.jambon.free.fr