CAMLP4(1)

NAME
camlp4 - Pre-Precessor-Pretty-Printer for OCaml
mkcamlp4 - Create custom camlp4
ocpp - Universal preprocessor

SYNOPSIS
camlp4 [ load-options ] [--] [ other-options ]
camlp4o [ load-options ] [--] [ other-options ]
camlp4r [ load-options ] [--] [ other-options ]
camlp4o.cma
camlp4r.cma
mkcamlp4
ocpp [ load-options ] file

camlp4o.opt [--] [ other-options ]
camlp4r.opt [--] [ other-options ]

DESCRIPTION
camlp4 is a Pre-Processor-Pretty-Printer for OCaml, parsing a source file and printing some result on standard output.

camlp4o and camlp4r are versions of camlp4 with some files already loaded (see below).

camlp4o.cma and camlp4r.cma are files to be loaded in ocaml toplevel to use the camlp4 machinery.

mkcamlp4 creates camlp4 executables with almost the same options as ocamlmktop (see below).

ocpp is an universal preprocessor, expanding quotations in any kind of text file.

camlp4o.opt and camlp4r.opt are versions of camlp4o and camlp4r compiled by the native-code compiler ocamlopt. They are faster but not extensible. And they are not available in all installations of camlp4.

LOAD OPTIONS
The load options select parsing and printing actions recorded in OCaml object files (ending with .cmo or .cma). They must precede other options.

An optional -- may end the load options.

-I directory
    Add directory in the search path for files loaded. Unless the option -nolib is used, the camlp4 library directory is appended to the path. Note that there is no automatic search in the current directory: add "-I ." for this.

-where
    Print camlp4 library directory name and exit.

-nolib
    No automatic search for objects files in camlp4 library directory.

object-file
    Load object-file in the camlp4 core.

OTHER OPTIONS

The others options are:

file
    Treat file as an interface file if it ends with .mli and as an implementation file if it ends with .ml.

-intf file
    Treat file as an interface file, whatever its extension is.

-impl file
    Treat file as an implementation file, whatever its extension is.

-unsafe
    Generate unsafe accesses to arrays and strings.

-noassert
    Do not compile assertion checks.

-verbose
    More verbose in parsing errors.

-QD file
    Dump in file in case of syntax error in the result of a quotation expansion.

-o out-file
    Print the result in out-file instead of standard output. File is opened with open_out_bin (see the documentation of the Pervasives OCaml library).

-v  Print the version number and exit.

-help
    Print the available options and exit. The output includes the options possibly added by the loaded object files.

The others options can be extended by loaded object files. The provided files add the following options:

-l line-length
    Added by pr_o.cmo and pr_r.cmo: set the line length (default 78).

-sep string
    Added by pr_o.cmo and pr_r.cmo: print this string between phrases instead of comments.

-no_ss
    Added by pr_o.cmo: do not print double semicolons

-D ident
    Added by pa_macro.cmo: define the ident.

-U ident
    Added by pa_macro.cmo: undefine the ident.

PROVIDED FILES
These files are installed in /usr/local/lib/metaocaml/lib/camlp4.

Parsing files:
	pa_o.cmo: syntax of OCaml
	pa_op.cmo: streams and parsers
	pa_oop.cmo: streams and parsers (without code optimization)
	pa_r.cmo: revised syntax
	pa_rp.cmo: streams and parsers
	pa_extend.cmo: syntax extension for grammars
	pa_extfold.cmo: extension of pa_extend with FOLD0 and FOLD1
	pa_extfun.cmo: syntax extension for extensible functions
	pa_fstream.cmo: syntax extension for functional streams
	pa_macro.cmo: add macros (ifdef, define) like in C
	pa_lefteval.cmo: left-to-right evaluation of parameters
	pa_olabl.cmo: old syntax for labels

Printing files:
	pr_o.cmo: syntax of OCaml
	pr_op.cmo: try to rebuild streams and parsers syntax
	pr_r.cmo: revised syntax
	pr_rp.cmo: try to rebuild streams and parsers syntax
	pr_extend.cmo: try to rebuild EXTEND statements
	pr_extfun.cmo: try to rebuild extfun statements
	pr_dump.cmo: syntax tree
	pr_depend.cmo: file dependencies
	pr_null.cmo: no output

Quotation expanders:
	q_MLast.cmo: syntax tree nodes
	q_phony.cmo: keeping quotations for pretty printing

The command camlp4o is a shortcut for:
	camlp4 pa_o.cmo pa_op.cmo pr_dump.cmo

The command camlp4r is a shortcut for:
	camlp4 pa_r.cmo pa_rp.cmo pr_dump.cmo

The file camlp4o.cma can be loaded in the toplevel to start camlp4 with OCaml syntax.

The file camlp4r.cma can be loaded in the toplevel to start camlp4 with revised syntax.

MKCAMLP4
mkcamlp4 creates camlp4 executables with almost the same options than ocamlmktop. The only difference is that the interfaces to be visible must be explicitly added in the command line as ".cmi" files. For example, how to add the the OCaml module "str":
	mkcamlp4 -custom str.cmi str.cma -cclib -lstr \
		-o camlp4str

FILES
Camlp4 library directory in the current installation:
/usr/local/lib/metaocaml/lib/camlp4

SEE ALSO
Camlp4 - tutorial
Camlp4 - reference manual
ocamlc(1), ocaml(1).

AUTHOR
Daniel de Rauglaudre, INRIA Rocquencourt.