Menhir 20240715 Parser Generator Reference Manual

Reference manual for Menhir version 20240715, a parser generator that turns high-level grammar specifications into parsers.


Menhir 20240715 Parser Generator Reference Manual - cover page
Brand
Menhir
Category
Programming
Document type
Programming Manual
Language
English
Pages
61
File format
PDF
File size
526 KB
Published
16 November, 2026
Updated
16 November, 2026
MD5 checksum
594501910156DB170BC6D0E64E7660C8

About this manual

Menhir is a parser generator that turns high-level grammar specifications decorated with semantic actions into parsers. It is based on Knuth’s LR(1) parser construction technique and is inspired by yacc, ML-Yacc, and ocamlyacc.

The manual covers usage, lexical conventions, grammar specification syntax, advanced features, conflicts, positions, interpreter mode, generated APIs, and error handling. It also describes the Coq back-end, building grammarware on top of Menhir, interaction with build systems, comparison with ocamlyacc, and technical background.

What's inside

  • Foreword
  • Usage
  • Lexical conventions
  • Syntax of grammar specifications
  • Advanced features
  • Conflicts
  • Generated API
  • Error handling: the new way
  • Coq back-end
  • Interaction with build systems

Specifications

Version20240715
Parser construction techniqueKnuth’s LR(1)
Default back-endcode
Table back-end option--table
Grammar file extension.mly
Coq grammar file extension.vy

Frequently asked questions

What is Menhir?

Menhir is a parser generator that turns high-level grammar specifications into parsers.

What parser construction technique does Menhir use?

Menhir uses Knuth’s LR(1) parser construction technique.

Which back-end is the default?

The code back-end is the default back-end.

How is the table back-end selected?

It is selected by passing --table on the command line.

Download PDF (526 KB)