]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/ocaml/contrib/man/ocaml.m
Update
[l4.git] / l4 / pkg / ocaml / ocaml / contrib / man / ocaml.m
1 \" $Id: ocaml.m 9162 2009-01-13 15:17:09Z doligez $
2
3 .TH OCAML 1
4
5 .SH NAME
6 ocaml \- The Objective Caml interactive toplevel
7
8 .SH SYNOPSIS
9 .B ocaml
10 [
11 .I options
12 ]
13 [
14 .I object-files
15 ]
16 [
17 .I script-file
18 ]
19 .SH DESCRIPTION
20
21 The
22 .BR ocaml (1)
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.
29
30 A toplevel phrase can span several lines. It is terminated by ;; (a
31 double-semicolon). The syntax of toplevel phrases is as follows.
32
33 The toplevel system is started by the command
34 .BR ocaml (1).
35 Phrases are read on standard input, results are printed on standard
36 output, errors on standard error. End-of-file on standard input
37 terminates
38 .BR ocaml (1).
39
40 If one or more
41 .I object-files
42 (ending in .cmo or .cma) are given, they are loaded silently before
43 starting the toplevel.
44
45 If a
46 .I script-file
47 is given, phrases are read silently from the file, errors printed on
48 standard error.
49 .BR ocaml (1)
50 exits after the execution of the last phrase.
51
52 .SH OPTIONS
53
54 The following command-line options are recognized by
55 .BR ocaml (1).
56 .TP
57 .BI \-I \ directory
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
61 with
62 .B \-I
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
65 directory.
66 .IP
67 If the given directory starts with
68 .BR + ,
69 it is taken relative to the
70 standard library directory. For instance,
71 .B \-I\ +labltk
72 adds the subdirectory
73 .B labltk
74 of the standard library to the search path.
75 .IP
76 Directories can also be added to the search path once the toplevel
77 is running with the
78 .B #directory
79 directive.
80 .TP
81 .BI \-init \ file
82 Load the given file instead of the default initialization file.
83 The default file is
84 .B .ocamlinit
85 in the current directory if it exists, otherwise
86 .B .ocamlinit
87 in the user's home directory.
88 .TP
89 .B \-labels
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.
92 .TP
93 .B \-noassert
94 Do not compile assertion checks.  Note that the special form
95 .B assert\ false
96 is always compiled because it is typed specially.
97 .TP
98 .B \-nolabels
99 Ignore non-optional labels in types. Labels cannot be used in
100 applications, and parameter order becomes strict.
101 .TP
102 .B \-noprompt
103 Do not display any prompt when waiting for input.
104 .TP
105 .B \-nostdlib
106 Do not include the standard library directory in the list of
107 directories searched for source and compiled files.
108 .TP
109 .B \-principal
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
116 .B \-principal
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.
121 .TP
122 .B \-rectypes
123 Allow arbitrary recursive types during type-checking.  By default,
124 only recursive types where the recursion goes through an object type
125 are supported.
126 .TP
127 .B \-unsafe
128 Turn bound checking off on array and string accesses (the
129 .BR v.(i) and s.[i]
130 constructs). Programs compiled with
131 .B \-unsafe
132 are therefore slightly faster, but unsafe: anything can happen if the program
133 accesses an array or string outside of its bounds.
134 .TP
135 .B \-version
136 Print version string and exit.
137 .TP
138 .BI \-w \ warning-list
139 Enable or disable warnings according to the argument
140 .IR warning-list .
141 See
142 .BR ocamlc (1)
143 for the syntax of the argument.
144 .TP
145 .BI \-warn-error \ warning-list
146 Treat as errors the warnings enabled by the argument
147 .IR warning-list .
148 See
149 .BR ocamlc (1)
150 for the syntax of the argument.
151 .TP
152 .BR \-help \ or \ \-\-help
153 Display a short usage summary and exit.
154
155 .SH ENVIRONMENT VARIABLES
156 .TP
157 .B LC_CTYPE
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.
161 .TP
162 .B TERM
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.
167
168 .SH SEE ALSO
169 .BR ocamlc (1), \ ocamlopt (1), \ ocamlrun (1).
170 .br
171 .IR The\ Objective\ Caml\ user's\ manual ,
172 chapter "The toplevel system".