Академический Документы
Профессиональный Документы
Культура Документы
NAME
ocaml - The OCaml interactive toplevel
SYNOPSIS
ocaml [ options ] [ object-files ] [ script-file ]
DESCRIPTION
The ocaml(1) command is the toplevel system for OCaml, that permits inte
ractive use of the OCaml sys
tem through a read-eval-print loop. In this mode, the system repeatedly r
eads OCaml phrases from the
input, then typechecks, compiles and evaluates them, then prints the in
ferred type and result value,
if any. The system prints a # (sharp) prompt before reading each phrase.
A toplevel phrase can span several lines. It is terminated by ;; (a doubl
e-semicolon). The syntax of
toplevel phrases is as follows.
The toplevel system is started by the command ocaml(1). Phrases are re
ad on standard input, results
are printed on standard output, errors on standard error. End-of-file on
standard input terminates
ocaml(1).
If one or more object-files (ending in .cmo or .cma) are given, they are
loaded silently before start
ing the toplevel.
If a script-file is given, phrases are read silently from the file, error
s printed on standard error.
ocaml(1) exits after the execution of the last phrase.
OPTIONS
The following command-line options are recognized by ocaml(1).
-absname
Show absolute filenames in error messages.
-I directory
Add the given directory to the list of directories searched for
source and compiled files. By
default, the current directory is searched first, then the standar
d library directory. Directo
ries added with -I are searched after the current directory, in
the order in which they were
given on the command line, but before the standard library directo
ry.
If the given directory starts with +, it is taken relative to the
standard library directory.
For instance, -I +labltk adds the subdirectory labltk of the s
tandard library to the search
path.
Directories can also be added to the search path once the toplevel
is running with the #direc
tory directive.
-init file
Load the given file instead of the default initialization file. T
he default file is .ocamlinit
in the current directory if it exists, otherwise .ocamlinit in the
user's home directory.
-labels
Labels are not ignored in types, labels may be used in application
s, and labelled parameters
can be given in any order. This is the default.
-no-app-funct
Deactivates the applicative behaviour of functors. With this opt
ion, each functor application
generates new types in its result and applying the same functor t
wice to the same argument
yields two incompatible structures.
-noassert
Do not compile assertion checks. Note that the special form as
sert false is always compiled
because it is typed specially.
-nolabels
Ignore non-optional labels in types. Labels cannot be used in appl
ications, and parameter order
becomes strict.
-noprompt
Do not display any prompt when waiting for input.
-nopromptcont
Do not display the secondary prompt when waiting for continuatio
n lines in multi-line inputs.
This should be used e.g. when running ocaml(1) in an emacs(1) wind
ow.
-nostdlib
Do not include the standard library directory in the list of direc
tories searched for source
and compiled files.
-ppx command
After parsing, pipe the abstract syntax tree through the preproc
essor command. The format of
the input and output of the preprocessor are not yet documented.
-principal
Check information path during type-checking, to make sure that all
types are derived in a prin
cipal way. When using labelled arguments and/or polymorphic meth
ods, this flag is required to
ensure future versions of the compiler will be able to infer types
correctly, even if internal
OCAML(1)