Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pippijn committed Jun 27, 2013
1 parent 359c6bc commit 1aca74f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@ Usage
The merr program takes several inputs to produce its error message function
from.

``
```
-t <terminals>
-e <errors.ml.in>
-a <automaton>
-p <parser command>
-o <output.ml>
``
```

### Terminal names

The terminals file contains an ocamlyacc grammar or tokens file amended with
token names. An extract of this file could look like this:

``ocaml
```ocaml
%token<string> TkIDENTIFIER "identifier"
%token TkIF "if"
%token TkTHEN "then"
%token TkELSE "else"
``
```

Merr uses these strings when producing default error messages, so that the
user doesn't see the internal names like "TkIDENTIFIER". Since menhir doesn't
Expand All @@ -56,7 +56,7 @@ and `token` is the token type constructor name, e.g. `TkIF`. The sample file
has a similar syntax as OCaml itself. The following is an excerpt from merr's
own error description.

``ocaml
```ocaml
module Tokens = Etokens
open Etoken (* provides string_of_token *)
open Etokens (* provides the 'token' type *)
Expand All @@ -70,7 +70,7 @@ own error description.
| "open Foo let message = function" -> function
| EOF -> "expected '|'-separated code fragments"
| _ -> "unexpected token '%s' where code fragments expected"
``
```

One or more `open` directives are always required, and the opened modules
should provide the function `val string_of_token : token -> string` and bring
Expand Down

0 comments on commit 1aca74f

Please sign in to comment.