Chapter 7 The OCaml language
Foreword
This document is intended as a reference manual for the OCamllanguage. It lists the language constructs, and gives their precisesyntax and informal semantics. It is by no means a tutorialintroduction to the language: there is not a single example. A goodworking knowledge of OCaml is assumed.
No attempt has been made at mathematical rigor: words are employedwith their intuitive meaning, without further definition. As aconsequence, the typing rules have been left out, by lack of themathematical framework required to express them, while they aredefinitely part of a full formal definition of the language.
Notations
The syntax of the language is given in BNF-like notation. Terminalsymbols are set in typewriter font (likethis).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 enclosedcomponents. Curly brackets with a trailing plus sign {…}+denote one or several repetitions of the enclosed components.Parentheses (…) denote grouping.