This document is intended as a reference manual for the Caml Light language. It lists all language constructs, and gives their precise syntax and informal semantics. It is by no means a tutorial introduction to the language: there is not a single example. A good working knowledge of the language, as provided by the companion tutorial Functional programming using Caml Light, is assumed.
No attempt has been made at mathematical rigor: words are employed with their intuitive meaning, without further definition. As a consequence, the typing rules have been left out, by lack of the mathematical framework required to express them, while they are definitely part of a full formal definition of the language. The reader interested in truly formal descriptions of languages from the ML family is referred to The definition of Standard ML and Commentary on Standard ML, by Milner, Tofte and Harper, MIT Press.
Several implementations of the Caml Light language are available, and they evolve at each release. Consequently, this document carefully distinguishes the language and its implementations. Implementations can provide extra language constructs; moreover, all points left unspecified in this reference manual can be interpreted differently by the implementations. The purpose of this reference manual is to specify those features that all implementations must provide.
The syntax of the language is given in BNF-like notation. Terminal
symbols are set in typewriter font (like
this
).
Non-terminal symbols are set in italic font (like that).
Square brackets [...] denote optional components. Curly brackets
{...} denotes zero, one or several repetitions of the enclosed
components. Curly bracket with a trailing plus sign {...}+
denote one or several repetitions of the enclosed components.
Parentheses (...) denote grouping.