Previous Contents Next
Chapter 1 Camlp4
Camlp4 is a Pre-Processor-Pretty-Printer for OCaml, parsing a source file and printing some result.

To run, Camlp4 needs to load files holding operations defining or modifying parsing (how to read the input file) and printing (how to print the result). Such files are OCaml object files (ending with ``.cmo'' or ``.cma'').

The command ``camlp4'' runs the Camlp4 program. The first options are objects (``.cmo'') or library (``.cma'') files which are loaded, selecting different parsing and printing operations. Among these first options, it is also possible to use the option ``-I'' to select directories where objects and library files are searched. But, important remark: by default, the system does not searches in the current directory: to select some object file, e.g. ``foo.cmo'' in the current directory, write ``./foo.cmo'' or add the option ``-I .''.

1.1 Camlp4 predefined files

The system provides some files, installed in Camlp4 library directory (depending on the installation, usually /usr/local/lib/camlp4: in the whole document, this directory is named camlp4-lib-dir). The provided files are:

Other predefined files allow to extend parsing and printing operations: