1 .\" $NetBSD: yacc.1,v 1.4 2011/09/10 21:38:59 christos Exp $
3 .\" Copyright (c) 1989, 1990 The Regents of the University of California.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" Robert Paul Corbett.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
17 .\" 3. Neither the name of the University nor the names of its contributors
18 .\" may be used to endorse or promote products derived from this software
19 .\" without specific prior written permission.
21 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .\" from: @(#)yacc.1 5.7 (Berkeley) 7/30/91
34 .\" from: Id: yacc.1,v 1.12 2011/09/08 00:40:44 tom Exp
35 .\" $NetBSD: yacc.1,v 1.4 2011/09/10 21:38:59 christos Exp $
49 .Op Fl o Ar outputfile
50 .Op Fl p Ar symbol_prefix
54 reads the grammar specification in the file
59 The parsers consist of a set of
61 parsing tables and a driver routine
62 written in the C programming language.
64 normally writes the parse tables and the driver routine to the file
67 The following options are available:
72 option changes the prefix prepended to the output file names to
75 The default prefix is the character
80 option causes the header file
83 It contains #define's for the token identifiers.
87 option causes a graphical description of the generated
89 parser to be written to the file
91 in graphviz format, ready to be processed by
96 option causes a supplementary header file
99 It contains extern declarations
100 and supplementary #define's as needed to map the conventional
102 yy-prefixed names to whatever the
107 is modified to #include this file
110 file, enforcing consistent usage of the symbols defined in those files.
111 The supplementary header file makes it simpler to separate compilation
112 of lex- and yacc-files.
116 option is not specified,
118 will insert #line directives in the generated code.
119 The #line directives let the C compiler relate errors in the
120 generated code to the user's original code.
125 will not insert the #line directives.
126 #line directives specified by the user will be retained.
127 .It Fl o Ar outputfile
130 option specifies an explicit output file name should be used instead
137 to create a reentrant parser, like
140 .It Fl p Ar symbol_prefix
143 option changes the prefix prepended to yacc-generated symbols to
144 the string denoted by
146 The default prefix is the string
153 to produce separate files for code and tables.
154 The code file is named
156 and the tables file is named
161 option changes the preprocessor directives generated by
163 so that debugging statements will be incorporated in the compiled code.
167 option prints the version number to the standard output.
171 option causes a human-readable description of the generated parser to
172 be written to the file
177 provides some extensions for compatibility with
179 and other implementations
183 .Bl -tag -width "%expect-rr number" -compact
184 .It Dv %expect Ar number
187 the expected number of shift/reduce conflicts.
188 That makes it only report the number if it differs.
189 .It Dv %expect-rr Ar number
192 the expected number of reduce/reduce conflicts.
193 That makes it only report the number if it differs.
199 .It Dv %lex-param Ar { Ar argument-declaration Ar }
200 By default, the lexer accepts no parameters, e.g.,
202 Use this directive to add parameter declarations for your customized lexer.
203 .It Dv %parse-param Ar { Ar argument-declaration Ar }
204 By default, the parser accepts no parameters, e.g.,
206 Use this directive to add parameter declarations for your customized parser.
208 Most variables (other than
212 are allocated on the stack within
214 making the parser reasonably reentrant.
217 The following environment variable is referenced by
219 .Bl -tag -width TMPDIR
221 If the environment variable
223 is set, the string denoted by
225 will be used as the name of the directory where the temporary
229 The names of the tables generated by this version of
242 Two additional tables,
248 is defined and non-zero.
250 .Bl -tag -width /tmp/yacc.uXXXXXXXX -compact
255 .It Pa /tmp/yacc.aXXXXXX
256 .It Pa /tmp/yacc.tXXXXXX
257 .It Pa /tmp/yacc.uXXXXXX
260 If there are rules that are never reduced, the number of such rules is
261 written to the standard error.
264 conflicts, the number of conflicts is also written
265 to the standard error.