1OCAMLYACC(1) General Commands Manual OCAMLYACC(1)
2
3
4
6 ocamlyacc - The OCaml parser generator
7
8
10 ocamlyacc [ -bprefix ] [ -q ] [ -v ] [ -version ] [ -vnum ] file‐
11 name.mly
12
13
15 The ocamlyacc(1) command produces a parser from a LALR(1) context-free
16 grammar specification with attached semantic actions, in the style of
17 yacc(1). Assuming the input file is grammar.mly, running ocamlyacc
18 produces OCaml code for a parser in the file grammar.ml, and its inter‐
19 face in file grammar.mli.
20
21 The generated module defines one parsing function per entry point in
22 the grammar. These functions have the same names as the entry points.
23 Parsing functions take as arguments a lexical analyzer (a function from
24 lexer buffers to tokens) and a lexer buffer, and return the semantic
25 attribute of the corresponding entry point. Lexical analyzer functions
26 are usually generated from a lexer specification by the ocamllex(1)
27 program. Lexer buffers are an abstract data type implemented in the
28 standard library module Lexing. Tokens are values from the concrete
29 type token, defined in the interface file grammar.mli produced by
30 ocamlyacc(1).
31
32
34 The ocamlyacc(1) command recognizes the following options:
35
36 -bprefix
37 Name the output files prefix.ml, prefix.mli, prefix.output,
38 instead of the default naming convention.
39
40 -q This option has no effect.
41
42 --strict
43 Reject grammars with conflicts.
44
45 -v Generate a description of the parsing tables and a report on
46 conflicts resulting from ambiguities in the grammar. The
47 description is put in file grammar.output.
48
49 -version
50 Print version string and exit.
51
52 -vnum Print short version number and exit.
53
54 - Read the grammar specification from standard input. The default
55 output file names are stdin.ml and stdin.mli.
56
57 -- file
58 Process file as the grammar specification, even if its name
59 starts with a dash (-) character. This option must be the last
60 on the command line.
61
62
64 ocamllex(1).
65 The OCaml user's manual, chapter "Lexer and parser generators".
66
67
68
69 OCAMLYACC(1)