Overview of the Caml Light implementation
The Caml Light system comprises the following parts:
- An interactive system, based on a read-eval-print loop: the user
enters a phrase, the system compiles it and executes it on the fly,
then print the outcome of evaluation. The interactive system is great
for learning the language and testing programs.
- A batch compiler and linker,
camlc
, with a
command-line interface similar to the one of C compilers. The compiler
produces standalone executable programs that can later be invoked just
as any other command on the system. It integrates smoothly within the
Unix programming environment (make, Emacs, ...).
- A medium-sized standard library, providing a number of
general-purpose functions and implementations of a few essential data
structures (lists, arrays, hash tables, sets, ...).
- A tool to build libraries of frequently-used program modules.
- A parser generator and a lexical analyzer generator, in the style
of
lex
and yacc
.
- Various programming tools:
- A source-level debugger with replay capabilities (``time travel'').
- An hypertext browser for modules.
- A simple Emacs editing mode, plus the ability to run the
toplevel or the debugger under Emacs.
- Search by types on modules.
Check here for more information.
- Several interface libraries:
- An extensive Graphic User Interface based on Tk.
- Portable graphic primitives (simple line and text drawings).
- Interface with the Unix system calls.
- Arbitrary-precision rational arithmetic (extremely efficient).
- High-level string operations (regular expressions, ...).
Availability
Caml Light is freely distributed for non-commercial use. Click
here to transfer it.
Caml Light is available on the following platforms:
- Most Unix machines. We have tested the current distribution on
the following machines, but many more have been reported to work:
- DecStation 3000/300 under OSF/1 2.0.
- Sun Sparcstation 10 under SunOS 4.1.
- DecStation 5000/200 under Ultrix 4.1.
- 486 PC under Linux 1.2.6
- Any Macintosh with at least 2M of RAM and System 6 or 7.
- Any PC under Windows 95, Windows NT, and also Windows 3.1
provided the
Win32s
compatibility system is installed.
- Any Atari ST machine with at least 2M of RAM.
Hardware requirements
Caml Light is implemented as a bytecode compiler (it produces code for
an abstract machine, which is then interpreted by a C program), hence
it is small, portable and has modest memory requirements. The runtime
system (the part written in C) is about 100K, plus another 100K of
bytecode for the compiler. The compiler itself is written in Caml
Light and ``bootstrapped'' -- compiled by itself.
2 megabytes of memory are enough to recompile the whole
system. Other implementations of ML generally use up at least ten
times more memory. The generated standalone programs are very small.
Performance
Because of the overhead of interpreting the bytecode, programs
generated by Caml Light run about ten times slower than programs
generated by the best native-code compilers. The slowdown is more
important for programs performing mostly arithmetic operations and
loops, and less important for highly symbolic computations.
Owing to their small memory footprints, Caml Light programs start up
quickly and do not cause virtual memory thrashing. Combined with
generational, incremental garbage collection, this makes interactive
Caml Light programs very responsive, with no annoying pauses in the
middle of user interaction.
The Caml Light compiler is so small and simple that it runs very
quickly (above 200 lines/second on a modern workstations), much faster
than native-code compilers. During the development phase, this often
compensates for the slow execution of the generated program.
The interactive, toplevel-based compiler is similarly very responsive.
Portability
Caml Light is written entirely in C and in Caml. The only assumptions
it makes are: a 32-bits or 64-bits architecture, with a flat address
space; a good quality C compiler (ANSI or K & R); and the POSIX
subsystem of Unix.