index.html 5.82 KB
Newer Older
1
<?xml version="1.0" encoding="UTF-8"?>
2 3 4
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 6
<html xml:lang="en" lang="en"
      xmlns="http://www.w3.org/1999/xhtml">
7 8

<head>
9
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
10
  <title>Menhir</title>
11 12
  <link href="https://fonts.googleapis.com/css?family=Carter+One" rel="stylesheet"/>
  <link rel="stylesheet" href="style.css"/>
13 14 15 16
</head>

<body>

17
<div class="contents">
18

19
<div class="header">
20
<h1 class="bar">Menhir</h1>
21

22
<div class="flexbox">
23
<div class="card card-1 card-header">
24 25
<h2 class="card-title">What is it?</h2>
<p class="card-contents">
26 27 28 29
Menhir is an LR(1) parser generator for
<a href="http://ocaml.org/">OCaml</a>:
it compiles LR(1) grammars down to OCaml code.
</p>
30
<p class="card-contents">
31 32 33 34 35 36 37 38
Menhir replaces
<a href="http://caml.inria.fr/pub/docs/manual-ocaml/lexyacc.html#sec278">ocamlyacc</a>.
Legacy grammars can be compiled by Menhir,
with a few caveats, described in the
<a href="doc/manual.html">reference manual</a>
(<a href="doc/manual.html">HTML</a>;
<a href="doc/manual.pdf">PDF</a>).
</p>
39
</div>
40

41
<div class="card card-1 card-header">
42 43
<h2 class="card-title">How to get it?</h2>
<p class="card-contents">
44
Menhir is available through <a href="http://opam.ocaml.org/">opam</a>,
45
OCaml's package manager.
46 47
</p>
<p class="card-contents">Type <code>opam install menhir</code>.
48
</p>
49
<p class="card-contents">
50 51 52 53 54
Menhir's source code is hosted in this
<a href="https://gitlab.inria.fr/fpottier/menhir/">repository</a>
(<a href="https://gitlab.inria.fr/fpottier/menhir/tags">releases</a>;
 <a href="https://gitlab.inria.fr/fpottier/menhir/blob/master/CHANGES.md">changes</a>).
</p>
55
</div>
56

57
<div class="card card-1 card-header">
58
<h2 class="card-title">How to get help?</h2>
59
<p class="card-contents">
60 61 62 63 64 65
There is a
<a href="https://sympa.inria.fr/sympa/info/menhir">mailing list</a>
for announcements of new releases and discussion of problems, bugs,
feature requests, and so on. Only subscribers can post.
</p>

66
<p class="card-contents">
67 68
Menhir has been designed and implemented by
<a href="http://gallium.inria.fr/~fpottier/">François Pottier</a> and
69
<a href="http://yann.regis-gianas.org/">Yann Régis-Gianas</a>.
70
</p>
71 72
</div>
</div>
73 74
</div>

75

76
<div class="widecard card-1" id="features">
77
<h2 class="card-title">What are the key features of Menhir?</h2>
78

79
<p class="card-contents subtitle">
80 81 82 83
Menhir has many features that make it superior to the traditional
yacc-style parser generators that many people are familiar with.
</p>

84
<div class="features">
85
<ul class="features">
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  <li>

    Menhir is not restricted to LALR(1) grammars. It accepts <b>LR(1)</b>
    grammars, thus avoiding certain artificial conflicts. When a grammar lies
    outside this class, Menhir <b>explains conflicts</b> in terms of the
    grammar, not just in terms of the automaton. Menhir's explanations are
    believed to be understandable by mere humans.

  </li><li>

    Menhir allows the definition of a nonterminal symbol to be
    <b>parameterized</b>. A formal parameter can be instantiated with a
    terminal symbol, a nonterminal symbol, or an anonymous rule.
    A <b>library</b> of standard parameterized definitions, including options,
    sequences, and lists, is bundled with Menhir. EBNF syntax is supported:
101
    the modifiers <code>?</code>, <code>+</code>, and <code>*</code> are
102 103 104 105 106
    sugar for options, nonempty lists, and arbitrary lists.
    Parameterized definitions are expanded away in a straightforward way.

  </li><li>

107
    Menhir's <b><code>&#37;inline</code></b> keyword allows indicating that
108 109 110 111 112 113 114 115 116 117
    a nonterminal symbol should be replaced with its definition at every
    use site. This offers a second macro-expansion mechanism.
    Together, these expansion mechanisms help write concise and elegant
    grammars, while avoiding LR(1) conflicts. In other words, they extend
    Menhir's expressive power <b>far beyond LR(1)</b>,
    while retaining the attractive features of LR(1):
    determinism, performance, guaranteed unambiguity.

  </li><li>

118
    In <code>--table</code> mode only, Menhir supports <b>incremental parsing</b>.
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
    This means that the state of the parser can be saved at any point (at no
    cost) and that parsing can later be resumed from a saved state.
    Furthermore, Menhir offers an <b>inspection API</b> which allows the
    parser's current state and stack to be examined by the user. This opens
    the door to a variety of advanced uses, including error explanation, error
    recovery, context-dependent lexical analysis, and so on.

  </li><li>

    Menhir offers a set of tools for building a (complete, irredundant)
    set of invalid input sentences, mapping each such sentence to a hand-written
    error message, and maintaining this mapping as the grammar evolves.
    Thus, <b>a generated parser can produce good syntax error messages</b>.

  </li><li>

    Menhir has a <a href="https://coq.inria.fr">Coq</a> back-end, which
    produces parsers whose correctness and completeness with respect to the
    grammar can be <b>verified by Coq</b>.

  </li><li>

    Menhir offers an <b>interpreter</b> that helps debug grammars interactively.

  </li><li>

    Menhir allows grammar specifications to be <b>split</b> over multiple files.
    It also allows several grammars to share a single set of tokens.

  </li><li>

    Menhir produces <b>reentrant</b> parsers.

  </li><li>

    Menhir is able to produce parsers that are <b>parameterized</b> by OCaml modules.

  </li><li>

158
    Instead of referring to semantic values via keywords: <code>$1</code>, <code>$2</code>,
159 160 161 162 163 164 165
    etc., Menhir allows semantic values to be explicitly <b>named</b>. In fact,
    Menhir now has
    <a href="https://gitlab.inria.fr/fpottier/menhir/blob/master/doc/new-rule-syntax-blog-post.md">fairly nice syntax</a>
    for describing grammars.

  </li>
</ul>
166
</div>
167
</div>
168
</div>
169
</body>
170
</html>