Annotation of src/usr.bin/yacc/yacc.1, Revision 1.13
1.13 ! aaron 1: .\" $OpenBSD: yacc.1,v 1.12 2000/07/06 04:06:58 aaron Exp $
1.10 aaron 2: .\"
1.1 deraadt 3: .\" Copyright (c) 1989, 1990 The Regents of the University of California.
4: .\" All rights reserved.
5: .\"
6: .\" This code is derived from software contributed to Berkeley by
7: .\" Robert Paul Corbett.
8: .\"
9: .\" Redistribution and use in source and binary forms, with or without
10: .\" modification, are permitted provided that the following conditions
11: .\" are met:
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. All advertising materials mentioning features or use of this software
18: .\" must display the following acknowledgement:
19: .\" This product includes software developed by the University of
20: .\" California, Berkeley and its contributors.
21: .\" 4. Neither the name of the University nor the names of its contributors
22: .\" may be used to endorse or promote products derived from this software
23: .\" without specific prior written permission.
24: .\"
25: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35: .\" SUCH DAMAGE.
36: .\"
37: .\" from: @(#)yacc.1 5.7 (Berkeley) 7/30/91
38: .\"
39: .Dd July 30, 1991
40: .Dt YACC 1
41: .Os
42: .Sh NAME
43: .Nm yacc
44: .Nd an
45: .Tn LALR(1)
46: parser generator
47: .Sh SYNOPSIS
48: .Nm yacc
49: .Op Fl dlrtv
50: .Op Fl b Ar prefix
1.5 aaron 51: .Op Fl o Ar output_file
1.2 deraadt 52: .Op Fl p Ar symbol_prefix
1.1 deraadt 53: .Ar filename
54: .Sh DESCRIPTION
1.10 aaron 55: .Nm
1.1 deraadt 56: reads the grammar specification in the file
57: .Ar filename
58: and generates an
59: .Tn LR(1)
60: parser for it.
61: The parsers consist of a set of
62: .Tn LALR(1)
63: parsing tables and a driver routine
64: written in the C programming language.
1.10 aaron 65: .Nm
1.1 deraadt 66: normally writes the parse tables and the driver routine to the file
67: .Pa y.tab.c .
68: .Pp
1.9 aaron 69: The options are as follows:
1.13 ! aaron 70: .Bl -tag -width Ds
1.1 deraadt 71: .It Fl b Ar prefix
72: The
73: .Fl b
74: option changes the prefix prepended to the output file names to
75: the string denoted by
76: .Ar prefix .
77: The default prefix is the character
78: .Ar y .
79: .It Fl d
80: The
81: .Fl d
82: option causes the header file
83: .Pa y.tab.h
84: to be written.
85: .It Fl l
86: If the
87: .Fl l
88: option is not specified,
1.10 aaron 89: .Nm
1.1 deraadt 90: will insert #line directives in the generated code.
91: The #line directives let the C compiler relate errors in the
92: generated code to the user's original code.
93: If the
94: .Fl l
95: option is specified,
1.10 aaron 96: .Nm
1.1 deraadt 97: will not insert the #line directives.
98: #line directives specified by the user will be retained.
1.5 aaron 99: .It Fl o Ar output_file
100: The
101: .Fl o
1.8 aaron 102: option specifies an explicit name for the parser's output file name instead
1.11 aaron 103: of the default.
104: The names of the other output files are constructed from
1.8 aaron 105: .Pa output_file
106: as described under the
107: .Fl d
108: and
109: .Fl v
110: options.
1.2 deraadt 111: .It Fl p Ar symbol_prefix
112: The
113: .Fl p
114: option changes the prefix prepended to yacc-generated symbols to
115: the string denoted by
116: .Ar symbol_prefix .
117: The default prefix is the string
118: .Ar yy .
1.1 deraadt 119: .It Fl r
120: The
121: .Fl r
122: option causes
1.10 aaron 123: .Nm
1.1 deraadt 124: to produce separate files for code and tables.
125: The code file is named
126: .Pa y.code.c ,
127: and the tables file is named
128: .Pa y.tab.c .
129: .It Fl t
130: The
131: .Fl t
132: option changes the preprocessor directives generated by
1.10 aaron 133: .Nm
1.1 deraadt 134: so that debugging statements will be incorporated in the compiled code.
135: .It Fl v
136: The
137: .Fl v
138: option causes a human-readable description of the generated parser to
139: be written to the file
140: .Pa y.output .
1.12 aaron 141: .El
1.1 deraadt 142: .Sh ENVIRONMENT
1.10 aaron 143: The following environment variables affect the execution of
1.1 deraadt 144: .Nm yacc :
145: .Bl -tag -width TMPDIR
146: .It Ev TMPDIR
1.10 aaron 147: Name of directory where temporary files are to be created.
1.1 deraadt 148: .El
149: .Sh TABLES
150: The names of the tables generated by this version of
1.10 aaron 151: .Nm
1.1 deraadt 152: are
153: .Dq yylhs ,
154: .Dq yylen ,
155: .Dq yydefred ,
156: .Dq yydgoto ,
157: .Dq yysindex ,
158: .Dq yyrindex ,
159: .Dq yygindex ,
160: .Dq yytable ,
161: and
162: .Dq yycheck .
163: Two additional tables,
164: .Dq yyname
165: and
166: .Dq yyrule ,
167: are created if
168: .Dv YYDEBUG
169: is defined and non-zero.
1.10 aaron 170: .Sh DIAGNOSTICS
171: If there are rules that are never reduced, the number of such rules is
172: written to the standard error.
173: If there are any
174: .Tn LALR(1)
175: conflicts, the number of conflicts is also written
176: to the standard error.
1.1 deraadt 177: .Sh FILES
1.7 millert 178: .Bl -tag -width /tmp/yacc.uXXXXXXXXXX -compact
1.1 deraadt 179: .It Pa y.code.c
180: .It Pa y.tab.c
181: .It Pa y.tab.h
182: .It Pa y.output
1.7 millert 183: .It Pa /tmp/yacc.aXXXXXXXXXX
184: .It Pa /tmp/yacc.tXXXXXXXXXX
185: .It Pa /tmp/yacc.uXXXXXXXXXX
1.1 deraadt 186: .El
1.7 millert 187: .Sh SEE ALSO
188: .Xr yyfix 1
1.1 deraadt 189: .Sh STANDARDS
190: The
1.10 aaron 191: .Nm
1.1 deraadt 192: utility conforms to
193: .St -p1003.2 .