1
2OCAMLYACC(1)                General Commands Manual               OCAMLYACC(1)
3
4
5

NAME

7       ocamlyacc - The Objective Caml parser generator
8
9

SYNOPSIS

11       ocamlyacc [ -v ] [ -bprefix ] filename.mly
12
13

DESCRIPTION

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

OPTIONS

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       -v     Generate  a  description  of  the parsing tables and a report on
43              conflicts  resulting  from  ambiguities  in  the  grammar.   The
44              description is put in file grammar.output.
45
46       -version
47              Print version and exit.
48
49       -      Read the grammar specification from standard input.  The default
50              output file names are stdin.ml and stdin.mli.
51
52       -- file
53              Process file as the grammar  specification,  even  if  its  name
54              starts  with a dash (-) character.  This option must be the last
55              on the command line.
56
57

SEE ALSO

59       ocamllex(1).
60       The Objective Caml user's manual, chapter  "Lexer  and  parser  genera‐
61       tors".
62
63
64
65                                                                  OCAMLYACC(1)
Impressum