MENHIR(1)
π MENHIR π
okay so bestie, we're doing the manual page for menhir, straight out of the General Commands Manual. It's section 1. It's a whole mood. Let's get into it. π
β¨ NAME β¨
menhir β an LR(1) parser generator for OCaml
πΈ SYNOPSIS πΈ
menhir [options] files
That's it. That's the whole vibe. Options, then your files. π¦
π DESCRIPTION π
So what is it? menhir is an LR(1) parser generator for the OCaml programming language. Which is to say: Menhir takes LR(1) grammar specifications and compiles them all the way down to OCaml code. β¨
And ngl, it's mostly compatible with ocamlyacc(1), so if you're coming from there, you're not starting from zero. periodt.
π OPTIONS π
There are a lot of these. Not me listing every single one. But I am. Because that's the assignment. π
-h,--helpβ Show a summary of the options. Your little cheat sheet. π«Ά-b,--basebasename β Sets a base name for the output file(s). Name the baby. β¨--canonicalβ Build a canonical Knuth LR(1) automaton. Very demure, very canonical.--cmlyβ Write the grammar and the automaton out tobasename.cmly.--commentβ Slide comments into the generated code. π¬--compare-errorsfile1--compare-errorsfile2 β Compare two.messagesfiles against each other. π--compile-errorsfile β Compile a.messagesfile into OCaml code.--coqβ Generate a formally verified parser, in Coq. formally verified?? we love a queen who can prove things. π--coq-lib-pathpath β How to qualify references toMenhirLib.--coq-lib-no-pathβ Don't qualify references toMenhirLib.--coq-no-actionsβ Ignore semantic actions in the Coq output.--coq-no-completeβ Don't generate a proof of completeness.--dependβ Invokeocamldepand display the dependencies.--dumpβ Describe the automaton in the filebasename.automaton.--dump-resolvedβ Describe the automaton after conflict resolution, in the filebasename.automaton.resolved.--echo-errorsfile β Echo out the sentences stored in the.messagesfile file.--echo-errors-concretefile β Same thing, but echo the sentences stored in the.messagesfile file in concrete syntax.--exn-carries-stateβ DeclaresError of int. The exceptionErrorthen carries the number of the state where a syntax error was detected. π¨--explainβ Explain the conflicts inbasename.conflicts. Drama explained. π--external-tokensmodule β Import the token type definition from module.--fixed-exceptionβ DeclaresError = Parsing.Parse_error.--inferβ Invokeocamlcto do type inference.--infer-protocol-supportedβ Stop with exit code0. That's it. That's the whole option. π--infer-write-queryfile β Write a mock.mlfile.--infer-read-replyfile β Read an inferred.mlifile.--inspectionβ Generate the inspection API.--interpretβ Interpret the sentences you feed in onstdin.--interpret-show-cstβ Show a concrete syntax tree once it accepts. π³--interpret-errorβ Interpret a single error sentence provided onstdin.--lalrβ Build an LALR(1) automaton.-la,--log-automatonlevel β Log info about the automaton.-lc,--log-codelevel β Log info about the generated code.-lg,--log-grammarlevel β Log info about the grammar.--list-errorsβ Produce a list of erroneous inputs. (A little hate-list, if you will. π)--merge-errorsfile1--merge-errorsfile2 β Merge two.messagesfiles.--no-dollarsβ Disallow the$inotation. no dollars allowed, we broke π--no-inlineβ Ignore the%inlinekeyword.--no-stdlibβ Don't load the standard library.--ocamlccommand β Specifies howocamlcshould be invoked.--ocamldepcommand β Specifies howocamldepshould be invoked.--only-preprocessβ Print a simplified grammar and exit.--only-preprocess-for-ocamlyaccβ Print the grammar inocamlyaccformat and exit.--only-preprocess-uβ Print the grammar with unit actions and exit.--only-preprocess-uuβ Print the grammar with unit actions and tokens, then exit.--only-tokensβ Generate the token type definition only, no code.--random-seedseed β Set the seed used by the random sentence generator to seed. π²--random-self-initβ Automatically set the seed used by the random sentence generator.--random-sentence-lengthlength β Ask the random sentence generator for a sentence of length at most length.--random-sentencesymbol β Produce a random sentence generated by the nonterminal symbol.--random-sentence-concretesymbol β Produce a random sentence generated by the nonterminal symbol, and print that sentence in concrete syntax.--raw-dependβ Invokeocamldepand echo its raw output.--require-aliasesβ Check that every terminal symbol has a token alias. no orphan tokens in this house π«Ά--strategystrategy β Choose how to deal with the error token.--strictβ Warnings about the grammar are errors. so if you were hoping to just vibe past them? no ma'am.--suggest-comp-flagsβ Suggest compilation flags forocaml{c,opt}.--suggest-link-flags-byteβ Suggest link flags forocamlc.--suggest-link-flags-optβ Suggest link flags forocamlopt.--suggest-menhirLibβ Suggest whereMenhirLibwas installed in source form.-t,--tableβ Use the table-based back-end.--timingsβ Display internal timings. β±οΈ--timings-tofile β Dump internal timings into file.--traceβ Include tracing instructions in the generated code.--unused-precedence-levelsβ Do not warn about unused precedence levels.--unused-tokentoken β Do not warn that token is unused.--unused-tokensβ Do not warn about any unused token, like, at all.--update-errorsfile β Update the auto-comments inside a.messagesfile.--versionβ Show the version number and exit.-vβ Synonymous with--dump --explain.
π SEE ALSO π
π AUTHOR π
menhir was written by FranΓ§ois Pottier and Yann RΓ©gis-Gianas. kings. π
This manual page was originally written by Samuel Mimram <smimram@debian.org> for the Debian project (but it may be used by others, so share the love π«Ά).
and that's the whole page bestie β from the General Commands Manual, dated <b>July 03, 2018</b>. go write a grammar, you absolute icon. πΈβ¨π
π¦ where this page comes from
- alpine 3.24: ocaml-menhir-doc 20220210-r6 Β· GPL-2.0-only
- debian bookworm: menhir 20220210+ds-2 Β· GPL-2.0-only
- debian trixie: menhir 20240715+ds-1+b2 Β· GPL-2.0-only
- fedora 43: ocaml-menhir 20250912-1.fc43 Β· GPL-2.0-only
- opensuse-leap 16.0: ocaml-menhir 20231231-160000.2.2 Β· LGPL-2.0
- opensuse-leap 16.0: ocaml-menhir 20231231-160000.2.2 Β· LGPL-2.0
- opensuse-leap 16.0: ocaml-menhir 20231231-160000.2.2 Β· LGPL-2.0
- opensuse-leap 16.0: ocaml-menhir 20231231-160000.2.2 Β· LGPL-2.0
- ubuntu noble: menhir 20231231+ds-1 Β· GPL-2.0-only
- ubuntu questing: menhir 20240715+ds-1build2
- ubuntu resolute: menhir 20250912+ds-1build2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms