1 \" $Id: ocaml.m 9162 2009-01-13 15:17:09Z doligez $
6 ocaml \- The Objective Caml interactive toplevel
23 command is the toplevel system for Objective Caml,
24 that permits interactive use of the Objective Caml system through a
25 read-eval-print loop. In this mode, the system repeatedly reads Caml
26 phrases from the input, then typechecks, compiles and evaluates
27 them, then prints the inferred type and result value, if any. The
28 system prints a # (sharp) prompt before reading each phrase.
30 A toplevel phrase can span several lines. It is terminated by ;; (a
31 double-semicolon). The syntax of toplevel phrases is as follows.
33 The toplevel system is started by the command
35 Phrases are read on standard input, results are printed on standard
36 output, errors on standard error. End-of-file on standard input
42 (ending in .cmo or .cma) are given, they are loaded silently before
43 starting the toplevel.
47 is given, phrases are read silently from the file, errors printed on
50 exits after the execution of the last phrase.
54 The following command-line options are recognized by
58 Add the given directory to the list of directories searched for
59 source and compiled files. By default, the current directory is
60 searched first, then the standard library directory. Directories added
63 are searched after the current directory, in the order in which they
64 were given on the command line, but before the standard library
67 If the given directory starts with
69 it is taken relative to the
70 standard library directory. For instance,
74 of the standard library to the search path.
76 Directories can also be added to the search path once the toplevel
82 Load the given file instead of the default initialization file.
85 in the current directory if it exists, otherwise
87 in the user's home directory.
90 Labels are not ignored in types, labels may be used in applications,
91 and labelled parameters can be given in any order. This is the default.
94 Do not compile assertion checks. Note that the special form
96 is always compiled because it is typed specially.
99 Ignore non-optional labels in types. Labels cannot be used in
100 applications, and parameter order becomes strict.
103 Do not display any prompt when waiting for input.
106 Do not include the standard library directory in the list of
107 directories searched for source and compiled files.
110 Check information path during type-checking, to make sure that all
111 types are derived in a principal way. When using labelled arguments
112 and/or polymorphic methods, this flag is required to ensure future
113 versions of the compiler will be able to infer types correctly, even
114 if internal algorithms change.
115 All programs accepted in
117 mode are also accepted in the
118 default mode with equivalent types, but different binary signatures,
119 and this may slow down type checking; yet it is a good idea to
120 use it once before publishing source code.
123 Allow arbitrary recursive types during type-checking. By default,
124 only recursive types where the recursion goes through an object type
128 Turn bound checking off on array and string accesses (the
130 constructs). Programs compiled with
132 are therefore slightly faster, but unsafe: anything can happen if the program
133 accesses an array or string outside of its bounds.
136 Print version string and exit.
138 .BI \-w \ warning-list
139 Enable or disable warnings according to the argument
143 for the syntax of the argument.
145 .BI \-warn-error \ warning-list
146 Treat as errors the warnings enabled by the argument
150 for the syntax of the argument.
152 .BR \-help \ or \ \-\-help
153 Display a short usage summary and exit.
155 .SH ENVIRONMENT VARIABLES
158 If set to iso_8859_1, accented characters (from the
159 ISO Latin-1 character set) in string and character literals are
160 printed as is; otherwise, they are printed as decimal escape sequences.
163 When printing error messages, the toplevel system
164 attempts to underline visually the location of the error. It
165 consults the TERM variable to determines the type of output terminal
166 and look up its capabilities in the terminal database.
169 .BR ocamlc (1), \ ocamlopt (1), \ ocamlrun (1).
171 .IR The\ Objective\ Caml\ user's\ manual ,
172 chapter "The toplevel system".