1MENHIR(1) General Commands Manual MENHIR(1)
2
3
4
6 menhir - an LR(1) parser generator for OCaml
7
8
10 menhir [options] files
11
13 menhir is an LR(1) parser generator for the OCaml programming language.
14 That is, Menhir compiles LR(1) grammar specifications down to OCaml
15 code. It is mostly compatible with ocamlyacc(1).
16
17
19 -h, --help
20 Show summary of options.
21
22 -b, --base basename
23 Specifies a base name for the output file(s).
24
25 --canonical
26 Construct a canonical Knuth LR(1) automaton.
27
28 --cmly Write the grammar and automaton to basename.cmly.
29
30 --comment
31 Include comments in the generated code.
32
33 --compare-errors file1 --compare-errors file2
34 Compare two .messages files.
35
36 --compile-errors file
37 Compile a .messages file to OCaml code.
38
39 --coq Generate a formally verified parser, in Coq.
40
41 --coq-lib-path path
42 How to qualify references to MenhirLib.
43
44 --coq-lib-no-path
45 Do not qualify references to MenhirLib.
46
47 --coq-no-actions
48 Ignore semantic actions in the Coq output.
49
50 --coq-no-complete
51 Do not generate a proof of completeness.
52
53 --depend
54 Invoke ocamldep and display dependencies.
55
56 --dump Describe the automaton in the file basename.automaton.
57
58 --dump-resolved
59 Describe the automaton, after conflict resolution, in the file
60 basename.automaton.resolved.
61
62 --echo-errors file
63 Echo the sentences stored in the .messages file file.
64
65 --echo-errors-concrete file
66 Echo the sentences stored in the .messages file file in concrete
67 syntax.
68
69 --exn-carries-state
70 Declares Error of int. The exception Error then carries the num‐
71 ber of the state where a syntax error is detected.
72
73 --explain
74 Explain conflicts in basename.conflicts.
75
76 --external-tokens module
77 Import token type definition from module.
78
79 --fixed-exception
80 Declares Error = Parsing.Parse_error.
81
82 --infer
83 Invoke ocamlc to do type inference.
84
85 --infer-protocol-supported
86 Stop with exit code 0.
87
88 --infer-write-query file
89 Write mock .ml file.
90
91 --infer-read-reply file
92 Read inferred .mli file.
93
94 --inspection
95 Generate the inspection API.
96
97 --interpret
98 Interpret the sentences provided on stdin.
99
100 --interpret-show-cst
101 Show a concrete syntax tree upon acceptance.
102
103 --interpret-error
104 Interpret an error sentence provided on stdin.
105
106 --lalr Construct an LALR(1) automaton.
107
108 -la, --log-automaton level
109 Log information about the automaton.
110
111 -lc, --log-code level
112 Log information about the generated code.
113
114 -lg, --log-grammar level
115 Log information about the grammar.
116
117 --list-errors
118 Produce a list of erroneous inputs.
119
120 --merge-errors file1 --merge-errors file2
121 Merge two .messages files.
122
123 --no-dollars
124 Disallow the use of $i notation.
125
126 --no-inline
127 Ignore the %inline keyword.
128
129 --no-stdlib
130 Do not load the standard library.
131
132 --ocamlc command
133 Specifies how ocamlc should be invoked.
134
135 --ocamldep command
136 Specifies how ocamldep should be invoked.
137
138 --only-preprocess
139 Print a simplified grammar and exit.
140
141 --only-preprocess-for-ocamlyacc
142 Print grammar in ocamlyacc format and exit.
143
144 --only-preprocess-u
145 Print grammar with unit actions and exit.
146
147 --only-preprocess-uu
148 Print grammar with unit actions and tokens and exit.
149
150 --only-tokens
151 Generate token type definition only, no code.
152
153 --random-seed seed
154 Set the seed used by the random sentence generator to seed.
155
156 --random-self-init
157 Automatically set the seed used by the random sentence genera‐
158 tor.
159
160 --random-sentence-length length
161 Ask the random sentence generator for a sentence of length at
162 most length.
163
164 --random-sentence symbol
165 Produce a random sentence that is generated by the nonterminal
166 symbol symbol.
167
168 --random-sentence-concrete symbol
169 Produce a random sentence that is generated by the nonterminal
170 symbol symbol, and print this sentence in concrete syntax.
171
172 --raw-depend
173 Invoke ocamldep and echo its raw output.
174
175 --require-aliases
176 Check that every terminal symbol has a token alias.
177
178 --strategy strategy
179 Choose how to deal with the error token.
180
181 --strict
182 Warnings about the grammar are errors.
183
184 --suggest-comp-flags
185 Suggest compilation flags for ocaml{c,opt}.
186
187 --suggest-link-flags-byte
188 Suggest link flags for ocamlc.
189
190 --suggest-link-flags-opt
191 Suggest link flags for ocamlopt.
192
193 --suggest-menhirLib
194 Suggest where MenhirLib was installed in source form.
195
196 -t, --table
197 Use the table-based back-end.
198
199 --timings
200 Display internal timings.
201
202 --timings-to file
203 Dump internal timings into file.
204
205 --trace
206 Include tracing instructions in the generated code.
207
208 --unused-precedence-levels
209 Do not warn about unused precedence levels.
210
211 --unused-token token
212 Do not warn that token is unused.
213
214 --unused-tokens
215 Do not warn about any unused token.
216
217 --update-errors file
218 Update auto-comments in a .messages file.
219
220 --version
221 Show version number and exit.
222
223 -v Synonymous with --dump --explain.
224
225
226
228 ocaml(1).
229
230
231
233 menhir was written by François Pottier and Yann Régis-Gianas.
234
235 This manual page was originally written by Samuel Mimram <smimram@de‐
236 bian.org> for the Debian project (but may be used by others).
237
238
239
240 July 03, 2018 MENHIR(1)