Caml Light program examples
This directory contains some examples of Caml Light programs.
The examples can either be compiled and executed as standalone
programs (just type make
in the subdirectory), or run
interactively under camllight
(the graphics programs must
be run under camllight camlgraph
), by executing
include "loadall";;
in the appropriate directory.
Examples marked (*) are taken from the book ``Le langage Caml'', by
Pierre Weis and Xavier Leroy (Dunod, 1993 & 1999). Messages and
identifiers are in French and contain accented letters (ISO 8859-1
encoding). You'll need an 8-bit clean system to read them.
Examples marked (G) assume installed the portable graphics library
(as found in the contrib/libgraph
directory of the Caml
Light distribution).
- basics:
Three all-time favorites: Fibonacci, Eratosthene's sieve, and the
Unix wc
utility.
- colwheel: (G)
The "color wheel" (color space in HSV coordinates).
Needs at least 256 colors to look good.
- spirals: (G)
Explore a family of flashy curves. (Use spir on a color screen
and spir-bw on a black and white screen.)
- showsort: (G)
Graphic animation of sorting algorithms.
- hanoi: (*)
Animated towers of Hanoi.
- docteur: (*)
A (French-speaking) clone of Eliza.
- calc:
This is a simple desk calculator that illustrates the use of camllex
and camlyacc.
- camltk: (*)
A set of programs to learn using the Caml/Tk graphical user
interface (GUI). From simple «hello world» program to an
advanced tetris game. Some examples are from the book ``Le
langage Caml'', by Pierre Weis and Xavier Leroy
(InterEditions, 1999). See the README file in the directory.
- picomach: (*)
An assembler and simulator for a RISC processor.
- grep: (*)
Regular expressions and automata.
- compress: (*)
File compression and decompression (Huffman).
- demonstr: (*)
Tautology checker.
- minicaml: (*)
An interpreter and typechecker for a subset of Caml.
- asl:
This is the implementation of A Small Language, as described in
part 3 of ``Functional Programming using Caml Light'', by
Michel Mauny.
- minilogo: (*) (G)
An interpreter for a small language with turtle graphics.
- pascal: (*)
An interpreter and compiler for a subset of Pascal.
The compiler generates code for the picomach
program.
- kb:
The Knuth-Bendix completion procedure for rewriting systems.
Taken from some course notes by Gerard Huet.
- camltk:
Examples for the camltk GUI toolkit.
- config:
This directory does not contain examples, but configuration
files used to generate the Makefiles.