1CAMLP4(1) General Commands Manual CAMLP4(1)
2
3
4
6 camlp4 - Pre-Precessor-Pretty-Printer for OCaml
7 mkcamlp4 - Create custom camlp4
8 ocpp - Universal preprocessor
9
10
12 camlp4 [ load-options ] [--] [ other-options ]
13 camlp4o [ load-options ] [--] [ other-options ]
14 camlp4r [ load-options ] [--] [ other-options ]
15 camlp4o.cma
16 camlp4r.cma
17 mkcamlp4
18 ocpp [ load-options ] file
19
20 camlp4o.opt [--] [ other-options ]
21 camlp4r.opt [--] [ other-options ]
22
23
25 camlp4 is a Pre-Processor-Pretty-Printer for OCaml, parsing a source
26 file and printing some result on standard output.
27
28 camlp4o and camlp4r are versions of camlp4 with some files already
29 loaded (see below).
30
31 camlp4o.cma and camlp4r.cma are files to be loaded in ocaml toplevel to
32 use the camlp4 machinery.
33
34 mkcamlp4 creates camlp4 executables with almost the same options as
35 ocamlmktop (see below).
36
37 ocpp is an universal preprocessor, expanding quotations in any kind of
38 text file.
39
40 camlp4o.opt and camlp4r.opt are versions of camlp4o and camlp4r com‐
41 piled by the native-code compiler ocamlopt. They are faster but not
42 extensible. And they are not available in all installations of camlp4.
43
44
46 The load options select parsing and printing actions recorded in OCaml
47 object files (ending with .cmo or .cma). They must precede other
48 options.
49
50
51 An optional -- may end the load options.
52
53
54 -I directory
55 Add directory in the search path for files loaded. Unless the
56 option -nolib is used, the camlp4 library directory is appended
57 to the path. Note that there is no automatic search in the cur‐
58 rent directory: add "-I ." for this.
59
60 -where Print camlp4 library directory name and exit.
61
62 -nolib No automatic search for objects files in camlp4 library direc‐
63 tory.
64
65 object-file
66 Load object-file in the camlp4 core.
67
68
70 The others options are:
71
72
73 file Treat file as an interface file if it ends with .mli and as an
74 implementation file if it ends with .ml.
75
76
77 -intf file
78 Treat file as an interface file, whatever its extension is.
79
80 -impl file
81 Treat file as an implementation file, whatever its extension is.
82
83 -unsafe
84 Generate unsafe accesses to arrays and strings.
85
86 -noassert
87 Do not compile assertion checks.
88
89 -verbose
90 More verbose in parsing errors.
91
92 -QD file
93 Dump in file in case of syntax error in the result of a quota‐
94 tion expansion.
95
96 -o out-file
97 Print the result in out-file instead of standard output. File is
98 opened with open_out_bin (see the documentation of the Perva‐
99 sives OCaml library).
100
101 -v Print the version number and exit.
102
103 -help Print the available options and exit. The output includes the
104 options possibly added by the loaded object files.
105
106
107 The others options can be extended by loaded object files. The provided
108 files add the following options:
109
110
111 -l line-length
112 Added by pr_o.cmo and pr_r.cmo: set the line length (default
113 78).
114
115 -sep string
116 Added by pr_o.cmo and pr_r.cmo: print this string between
117 phrases instead of comments.
118
119 -no_ss Added by pr_o.cmo: do not print double semicolons
120
121 -D ident
122 Added by pa_macro.cmo: define the ident.
123
124 -U ident
125 Added by pa_macro.cmo: undefine the ident.
126
127
129 These files are installed in /usr/lib64/ocaml/camlp4.
130
131
132 Parsing files:
133 pa_o.cmo: syntax of OCaml
134 pa_op.cmo: streams and parsers
135 pa_oop.cmo: streams and parsers (without code optimization)
136 pa_r.cmo: revised syntax
137 pa_rp.cmo: streams and parsers
138 pa_extend.cmo: syntax extension for grammars
139 pa_extfold.cmo: extension of pa_extend with FOLD0 and FOLD1
140 pa_extfun.cmo: syntax extension for extensible functions
141 pa_fstream.cmo: syntax extension for functional streams
142 pa_macro.cmo: add macros (ifdef, define) like in C
143 pa_lefteval.cmo: left-to-right evaluation of parameters
144 pa_olabl.cmo: old syntax for labels
145
146 Printing files:
147 pr_o.cmo: syntax of OCaml
148 pr_op.cmo: try to rebuild streams and parsers syntax
149 pr_r.cmo: revised syntax
150 pr_rp.cmo: try to rebuild streams and parsers syntax
151 pr_extend.cmo: try to rebuild EXTEND statements
152 pr_extfun.cmo: try to rebuild extfun statements
153 pr_dump.cmo: syntax tree
154 pr_depend.cmo: file dependencies
155 pr_null.cmo: no output
156
157 Quotation expanders:
158 q_MLast.cmo: syntax tree nodes
159 q_phony.cmo: keeping quotations for pretty printing
160
161 The command camlp4o is a shortcut for:
162 camlp4 pa_o.cmo pa_op.cmo pr_dump.cmo
163
164 The command camlp4r is a shortcut for:
165 camlp4 pa_r.cmo pa_rp.cmo pr_dump.cmo
166
167 The file camlp4o.cma can be loaded in the toplevel to start camlp4 with
168 OCaml syntax.
169
170 The file camlp4r.cma can be loaded in the toplevel to start camlp4 with
171 revised syntax.
172
173
175 mkcamlp4 creates camlp4 executables with almost the same options than
176 ocamlmktop. The only difference is that the interfaces to be visible
177 must be explicitly added in the command line as ".cmi" files. For exam‐
178 ple, how to add the the OCaml module "str":
179
180 mkcamlp4 -custom str.cmi str.cma -cclib -lstr \
181 -o camlp4str
182
183
185 Camlp4 library directory in the current installation:
186 /usr/lib64/ocaml/camlp4
187
188
190 Camlp4 - tutorial
191 Camlp4 - reference manual
192 ocamlc(1), ocaml(1).
193
194
196 Daniel de Rauglaudre, INRIA Rocquencourt.
197
198
199
200INRIA CAMLP4(1)