1CAMLP5(1) General Commands Manual CAMLP5(1)
2
3
4
6 camlp5 - Pre-Precessor-Pretty-Printer for OCaml
7 mkcamlp5 - Create custom camlp5
8 mkcamlp5.opt - Create custom camlp5 (native code)
9 ocpp5 - Universal preprocessor
10
11
13 camlp5 [ load-options ] [--] [ other-options ]
14 camlp5o [ load-options ] [--] [ other-options ]
15 camlp5r [ load-options ] [--] [ other-options ]
16 camlp5sch [ load-options ] [--] [ other-options ]
17 camlp5o.cma
18 camlp5r.cma
19 camlp5sch.cma
20 mkcamlp5
21 mkcamlp5.opt
22 ocpp5 [ load-options ] file
23
24 camlp5o.opt [--] [ other-options ]
25 camlp5r.opt [--] [ other-options ]
26
27
29 camlp5 is a Pre-Processor-Pretty-Printer for OCaml, parsing a source
30 file and printing some result on standard output.
31
32 camlp5o, camlp5r and camlp5sch are versions of camlp5 with some files
33 already loaded (see further).
34
35 camlp5o.cma, camlp5r.cma and camlp5sch.cma are files to be loaded in
36 ocaml toplevel to use the camlp5 machinery
37
38 mkcamlp5 and mkcamlp5.opt creates camlp5 executables with almost the
39 same options than ocamlmktop. See further.
40
41 ocpp5 is an universal preprocessor, treating any kind of source file,
42 generating the same text with the possible quotations expanded.
43
44 camlp5o.opt and camlp5r.opt are versions of camlp5o and camlp5r com‐
45 piled by the native-code compiler ocamlopt. They are faster but not
46 extensible. And they are not available in all installations of camlp5.
47
48
50 The load options select parsing and printing actions recorded in OCaml
51 object files (ending with .cmo or .cma). Several usage of these options
52 are authorized. They must precede the other options.
53
54
55 An optional -- may end the load options.
56
57
58 -I directory
59 Add directory in the search path for files loaded. Unless the
60 option -nolib is used, the camlp5 library directory is appended
61 to the path. Warning: there is no automatic search in the cur‐
62 rent directory: add "-I ." for this.
63
64 -where Print camlp5 library directory name and exit.
65
66 -nolib No automatic search for objects files in camlp5 library direc‐
67 tory.
68
69 object-file
70 The file is loaded in camlp5 core.
71
72
74 The others options are:
75
76
77 file Treat file as an interface file if it ends with .mli and as an
78 implementation file if it ends with .ml.
79
80
81 -intf file
82 Treat file as an interface file, whatever its extension.
83
84 -impl file
85 Treat file as an implementation file, whatever its extension.
86
87 -unsafe
88 Generate unsafe accesses to arrays and strings.
89
90 -noassert
91 Do not compile assertion checks.
92
93 -verbose
94 More verbose in parsing errors.
95
96 -QD file
97 Dump in file in case of syntax error in the result of a quota‐
98 tion expansion.
99
100 -o out-file
101 Print the result on out-file instead of standard output. File is
102 opened with open_out_bin (see OCaml library Pervasives).
103
104 -v Print the version number and exit.
105
106 -help Print the available options and exit. This print includes the
107 options possibly added by the loaded object files.
108
109
110 The others options can be extended by loaded object files. The provided
111 files add the following options:
112
113
114 -l line-length
115 Added by pr_o.cmo and pr_r.cmo: set the line length (default
116 78).
117
118 -sep string
119 Added by pr_o.cmo and pr_r.cmo: print this string between
120 phrases instead of comments.
121
122 -no_ss Added by pr_o.cmo: do not print double semicolons
123
124 -D ident
125 Added by pa_macro.cmo: define the ident.
126
127 -U ident
128 Added by pa_macro.cmo: undefine the ident.
129
130
132 These files are installed in the directory /usr/lib64/ocaml/camlp5.
133
134
135 Parsing files:
136 pa_r.cmo: revised syntax
137 pa_rp.cmo: streams and parsers
138 pa_lexer.cmo: lexers
139 pa_o.cmo: normal syntax
140 pa_op.cmo: streams and parsers
141 pa_oop.cmo: streams and parsers (without code optimization)
142 pa_scheme.cmo: scheme syntax
143 pa_extend.cmo: syntax extension for grammars
144 pa_extfold.cmo: extension of pa_extend with FOLD0 and FOLD1
145 pa_extfun.cmo: syntax extension for extensible functions
146 pa_extprint.cmo: syntax extensions for extensible printers
147 pa_pprintf.cmo: syntax extension for pprintf statement
148 pa_fstream.cmo: syntax extension for functional streams
149 pa_macro.cmo: add macros (ifdef, define) like in C
150 pa_lefteval.cmo: left-to-right evaluation of parameters
151 pa_pragma.cmo: directive #pragma
152
153 Printing files:
154 pr_r.cmo: revised syntax without objects and labels
155 pr_ro.cmo: revised syntax for objects and labels
156 pr_rp.cmo: try to rebuild streams and parsers syntax
157 pr_o.cmo: normal syntax
158 pr_op.cmo: try to rebuild streams and parsers syntax
159 pr_scheme.cmo: Scheme syntax
160 pr_schemep.cmo: try to rebuild streams and parsers syntax
161 pr_extend.cmo: try to rebuild EXTEND statements
162 pr_extfun.cmo: try to rebuild extfun statements
163 pr_extprint.cmo: try to rebuild EXTEND_PRINTER statements
164 pr_dump.cmo: dump syntax tree for ocaml compiler
165 pr_depend.cmo: file dependencies
166 pr_null.cmo: no output
167
168 Quotation expanders:
169 q_MLast.cmo: syntax tree nodes (in revised syntax)
170 q_ast.cmo: syntax tree nodes in user full syntax
171 q_phony.cmo: keeping quotations for pretty printing
172
173 The command camlp5o is a shortcut for:
174 camlp5 pa_o.cmo pa_op.cmo pr_dump.cmo
175
176 The command camlp5r is a shortcut for:
177 camlp5 pa_r.cmo pa_rp.cmo pr_dump.cmo
178
179 The command camlp5sch is a shortcut for:
180 camlp5 pa_scheme.cmo pr_dump.cmo
181
182 The file camlp5o.cma can be loaded in the toplevel to start camlp5 with
183 OCaml syntax.
184
185 The file camlp5r.cma can be loaded in the toplevel to start camlp5 with
186 revised syntax.
187
188 The file camlp5sch.cma can be loaded in the toplevel to start camlp5
189 with Scheme syntax.
190
191
193 mkcamlp5 and mkcamlp5.opt creates camlp5 executables with almost the
194 same options than ocamlmktop. The version mkcamlp5.opt can create
195 native code executables, faster but not extensible.
196
197 For mkcamlp5, the interfaces to be visible must be explicitly added in
198 the command line as ".cmi" files. For example, how to add the the OCaml
199 module "str":
200 mkcamlp5 -custom str.cmi str.cma -cclib -lstr -o camlp5str
201
203 The following environment variable is also consulted:
204
205
206 CAMLP5PARAM
207 Set the grammars parsing algorithm parameters. This variable
208 must be a sequence of parameter specifications. A parameter
209 specification is a letter optionally followed by an = and a
210 value. There are four possible parameters:
211
212
213 b (backtrack)
214 Set the backtrack algorithm as default.
215
216 t (trace)
217 Trace symbols (terminals and non-terminals) while parsing with
218 backtracking.
219
220 y (trace-stalling)
221 In backtracking, trace the advance in the input stream (number
222 of unfrozen tokens) and the possible stalling (number of tokens
223 tests).
224
225 l (maximum-stalling)
226 Set the maximum stalling value.
227
228
230 Library directory of camlp5 in the present installation:
231 /usr/lib64/ocaml/camlp5
232
233
235 Camlp5 - Reference Manual
236 ocamlc(1), ocaml(1), ocamlmktop(1).
237
238
240 Daniel de Rauglaudre, INRIA Rocquencourt.
241
242
243
244INRIA CAMLP5(1)