logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

menhir - an LR(1) parser generator for OCaml

Author

menhir was written by François Pottier and Yann Régis-Gianas.

       This manual page was originally written by Samuel Mimram <smimram@debian.org> for the Debian project (but
       may be used by others).

                                                  July 03, 2018                                        MENHIR(1)

Description

menhir  is  an LR(1) parser generator for the OCaml programming language.  That is, Menhir compiles LR(1)
       grammar specifications down to OCaml code. It is mostly compatible with ocamlyacc(1).

Name

       menhir - an LR(1) parser generator for OCaml

Options

-h,--help
              Show summary of options.

       -b,--basebasename
              Specifies a base name for the output file(s).

       --canonical
              Construct a canonical Knuth LR(1) automaton.

       --cmly Write the grammar and automaton to basename.cmly.

       --comment
              Include comments in the generated code.

       --compare-errorsfile1--compare-errorsfile2
              Compare two .messages files.

       --compile-errorsfile
              Compile a .messages file to OCaml code.

       --coq  Generate a formally verified parser, in Coq.

       --coq-lib-pathpath
              How to qualify references to MenhirLib.

       --coq-lib-no-path
              Do not qualify references to MenhirLib.

       --coq-no-actions
              Ignore semantic actions in the Coq output.

       --coq-no-complete
              Do not generate a proof of completeness.

       --depend
              Invoke ocamldep and display 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-errorsfile
              Echo the sentences stored in the .messages file file.

       --echo-errors-concretefile
              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 is detected.

       --explain
              Explain conflicts in basename.conflicts.

       --external-tokensmodule
              Import 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.

       --infer-write-queryfile
              Write mock .ml file.

       --infer-read-replyfile
              Read inferred .mli file.

       --inspection
              Generate the inspection API.

       --interpret
              Interpret the sentences provided on stdin.

       --interpret-show-cst
              Show a concrete syntax tree upon acceptance.

       --interpret-error
              Interpret an error sentence provided on stdin.

       --lalr Construct an LALR(1) automaton.

       -la,--log-automatonlevel
              Log information about the automaton.

       -lc,--log-codelevel
              Log information about the generated code.

       -lg,--log-grammarlevel
              Log information about the grammar.

       --list-errors
              Produce a list of erroneous inputs.

       --merge-errorsfile1--merge-errorsfile2
              Merge two .messages files.

       --no-dollars
              Disallow the use of $i notation.

       --no-inline
              Ignore the %inline keyword.

       --no-stdlib
              Do not load the standard library.

       --ocamlccommand
              Specifies how ocamlc should be invoked.

       --ocamldepcommand
              Specifies how ocamldep should be invoked.

       --only-preprocess
              Print a simplified grammar and exit.

       --only-preprocess-for-ocamlyacc
              Print grammar in ocamlyacc format and exit.

       --only-preprocess-u
              Print grammar with unit actions and exit.

       --only-preprocess-uu
              Print grammar with unit actions and tokens and exit.

       --only-tokens
              Generate 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 that is generated by the nonterminal symbol symbol.

       --random-sentence-concretesymbol
              Produce  a  random  sentence  that  is  generated by the nonterminal symbol symbol, and print this
              sentence in concrete syntax.

       --raw-depend
              Invoke ocamldep and echo its raw output.

       --require-aliases
              Check that every terminal symbol has a token alias.

       --strategystrategy
              Choose how to deal with the error token.

       --strict
              Warnings about the grammar are errors.

       --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-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.

       --update-errorsfile
              Update auto-comments in a .messages file.

       --version
              Show version number and exit.

       -v     Synonymous with --dump--explain.

See Also

ocaml(1).

Synopsis

menhir [options] files

See Also