[Caml-list] ocamlscript 2.0.0

1 view
Skip to first unread message

Martin Jambon

Mar 5, 2007, 4:48:54 PM3/5/07
to caml...@inria.fr
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:


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


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.


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 Jambon

Caml-list mailing list. Subscription management:
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply all
Reply to author
0 new messages