Merge commit 'ocaml3102'
[ocaml.git] / man / ocaml.m
blob47c263a7f0a4ebb94eeab4c4c42ba97a614955cf
1 .TH OCAML 1
3 .SH NAME
4 ocaml \- The Objective Caml interactive toplevel
7 .SH SYNOPSIS
8 .B ocaml
10 .B \-unsafe
13 .BI \-I \ lib-dir
16 .I object-files
19 .I script-file
21 .SH DESCRIPTION
23 The
24 .BR ocaml (1)
25 command is the toplevel system for Objective Caml,
26 that permits interactive use of the Objective Caml system through a
27 read-eval-print loop. In this mode, the system repeatedly reads Caml
28 phrases from the input, then typechecks, compiles and evaluates
29 them, then prints the inferred type and result value, if any. The
30 system prints a # (sharp) prompt before reading each phrase.
32 A toplevel phrase can span several lines. It is terminated by ;; (a
33 double-semicolon). The syntax of toplevel phrases is as follows.
35 The toplevel system is started by the command 
36 .BR ocaml (1).
37 Phrases are read on standard input, results are printed on standard
38 output, errors on standard error. End-of-file on standard input
39 terminates
40 .BR ocaml (1).
42 If one or more
43 .I object-files
44 (ending in
45 .B .cmo
47 .B .cma
48  ) are given, they are loaded silently before starting the toplevel.
50 If a
51 .I script-file
52 is given, phrases are read silently from the file, errors printed on
53 standard error.
54 .BR ocaml (1)
55 exits after the execution of the last phrase.
57 .SH OPTIONS
59 The following command-line options are recognized by
60 .BR ocaml (1).
62 .TP
63 .BI \-I \ directory
64 Add the given directory to the list of directories searched for
65 source and compiled files. By default, the current directory is
66 searched first, then the standard library directory. Directories added
67 with 
68 .B \-I
69 are searched after the current directory, in the order in which they
70 were given on the command line, but before the standard library
71 directory.
73 .TP
74 .B \-unsafe
75 Turn bound checking off on array and string accesses (the v.(i)
76 and s.[i] constructs). Programs compiled with 
77 .B \-unsafe
78 are therefore slightly faster, but unsafe: anything can happen if the program
79 accesses an array or string outside of its bounds.
81 .SH ENVIRONMENT VARIABLES
83 .TP
84 .B LC_CTYPE
85 If set to iso_8859_1, accented characters (from the
86 ISO Latin-1 character set) in string and character literals are
87 printed as is; otherwise, they are printed as decimal escape sequences.
89 .TP
90 .B TERM
91 When printing error messages, the toplevel system
92 attempts to underline visually the location of the error. It
93 consults the TERM variable to determines the type of output terminal
94 and look up its capabilities in the terminal database.
96 .SH SEE ALSO
97 .BR ocamlc (1).
98 .br
99 .I The Objective Caml user's manual,
100 chapter "The toplevel system".