MENHIR(1)

πŸ“¦
this version Β· 3 versions
, in alpine 3.24, debian bookworm, debian trixie, fedora 43, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute

πŸ’– 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, --base basename β€” 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 to basename.cmly.
  • --comment β€” Slide comments into the generated code. πŸ’¬
  • --compare-errors file1 --compare-errors file2 β€” Compare two .messages files against each other. πŸ‘€
  • --compile-errors file β€” Compile a .messages file into OCaml code.
  • --coq β€” Generate a formally verified parser, in Coq. formally verified?? we love a queen who can prove things. πŸ‘‘
  • --coq-lib-path path β€” How to qualify references to MenhirLib.
  • --coq-lib-no-path β€” Don't qualify references to MenhirLib.
  • --coq-no-actions β€” Ignore semantic actions in the Coq output.
  • --coq-no-complete β€” Don't generate a proof of completeness.
  • --depend β€” Invoke ocamldep and display the dependencies.
  • --dump β€” Describe the automaton in the file basename.automaton.
  • --dump-resolved β€” Describe the automaton after conflict resolution, in the file basename.automaton.resolved.
  • --echo-errors file β€” Echo out the sentences stored in the .messages file file.
  • --echo-errors-concrete file β€” Same thing, but echo the sentences stored in the .messages file file in concrete syntax.
  • --exn-carries-state β€” Declares Error of int. The exception Error then carries the number of the state where a syntax error was detected. 🚨
  • --explain β€” Explain the conflicts in basename.conflicts. Drama explained. πŸ’€
  • --external-tokens module β€” Import the token type definition from module.
  • --fixed-exception β€” Declares Error = Parsing.Parse_error.
  • --infer β€” Invoke ocamlc to do type inference.
  • --infer-protocol-supported β€” Stop with exit code 0. That's it. That's the whole option. 😭
  • --infer-write-query file β€” Write a mock .ml file.
  • --infer-read-reply file β€” Read an inferred .mli file.
  • --inspection β€” Generate the inspection API.
  • --interpret β€” Interpret the sentences you feed in on stdin.
  • --interpret-show-cst β€” Show a concrete syntax tree once it accepts. 🌳
  • --interpret-error β€” Interpret a single error sentence provided on stdin.
  • --lalr β€” Build an LALR(1) automaton.
  • -la, --log-automaton level β€” Log info about the automaton.
  • -lc, --log-code level β€” Log info about the generated code.
  • -lg, --log-grammar level β€” Log info about the grammar.
  • --list-errors β€” Produce a list of erroneous inputs. (A little hate-list, if you will. πŸ™ˆ)
  • --merge-errors file1 --merge-errors file2 β€” Merge two .messages files.
  • --no-dollars β€” Disallow the $i notation. no dollars allowed, we broke πŸ’€
  • --no-inline β€” Ignore the %inline keyword.
  • --no-stdlib β€” Don't load the standard library.
  • --ocamlc command β€” Specifies how ocamlc should be invoked.
  • --ocamldep command β€” Specifies how ocamldep should be invoked.
  • --only-preprocess β€” Print a simplified grammar and exit.
  • --only-preprocess-for-ocamlyacc β€” Print the grammar in ocamlyacc format 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-seed seed β€” 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-length length β€” Ask the random sentence generator for a sentence of length at most length.
  • --random-sentence symbol β€” Produce a random sentence generated by the nonterminal symbol.
  • --random-sentence-concrete symbol β€” Produce a random sentence generated by the nonterminal symbol, and print that sentence in concrete syntax.
  • --raw-depend β€” Invoke ocamldep and echo its raw output.
  • --require-aliases β€” Check that every terminal symbol has a token alias. no orphan tokens in this house 🫢
  • --strategy strategy β€” 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 for ocaml{c,opt}.
  • --suggest-link-flags-byte β€” Suggest link flags for ocamlc.
  • --suggest-link-flags-opt β€” Suggest link flags for ocamlopt.
  • --suggest-menhirLib β€” Suggest where MenhirLib was installed in source form.
  • -t, --table β€” Use the table-based back-end.
  • --timings β€” Display internal timings. ⏱️
  • --timings-to file β€” Dump internal timings into file.
  • --trace β€” Include tracing instructions in the generated code.
  • --unused-precedence-levels β€” Do not warn about unused precedence levels.
  • --unused-token token β€” Do not warn that token is unused.
  • --unused-tokens β€” Do not warn about any unused token, like, at all.
  • --update-errors file β€” Update the auto-comments inside a .messages file.
  • --version β€” Show the version number and exit.
  • -v β€” Synonymous with --dump --explain.

🌈 SEE ALSO 🌈

ocaml(1).


πŸ’œ 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. πŸŒΈβœ¨πŸ’–