Annotation of src/usr.bin/yacc/yacc.1, Revision 1.11
1.11 ! aaron 1: .\" $OpenBSD: yacc.1,v 1.10 2000/03/14 14:58:27 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.1 deraadt 70: .Bl -tag -width Ar
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 .
141: .Sh ENVIRONMENT
1.10 aaron 142: The following environment variables affect the execution of
1.1 deraadt 143: .Nm yacc :
144: .Bl -tag -width TMPDIR
145: .It Ev TMPDIR
1.10 aaron 146: Name of directory where temporary files are to be created.
1.1 deraadt 147: .El
148: .Sh TABLES
149: The names of the tables generated by this version of
1.10 aaron 150: .Nm
1.1 deraadt 151: are
152: .Dq yylhs ,
153: .Dq yylen ,
154: .Dq yydefred ,
155: .Dq yydgoto ,
156: .Dq yysindex ,
157: .Dq yyrindex ,
158: .Dq yygindex ,
159: .Dq yytable ,
160: and
161: .Dq yycheck .
162: Two additional tables,
163: .Dq yyname
164: and
165: .Dq yyrule ,
166: are created if
167: .Dv YYDEBUG
168: is defined and non-zero.
1.10 aaron 169: .Sh DIAGNOSTICS
170: If there are rules that are never reduced, the number of such rules is
171: written to the standard error.
172: If there are any
173: .Tn LALR(1)
174: conflicts, the number of conflicts is also written
175: to the standard error.
1.1 deraadt 176: .Sh FILES
1.7 millert 177: .Bl -tag -width /tmp/yacc.uXXXXXXXXXX -compact
1.1 deraadt 178: .It Pa y.code.c
179: .It Pa y.tab.c
180: .It Pa y.tab.h
181: .It Pa y.output
1.7 millert 182: .It Pa /tmp/yacc.aXXXXXXXXXX
183: .It Pa /tmp/yacc.tXXXXXXXXXX
184: .It Pa /tmp/yacc.uXXXXXXXXXX
1.1 deraadt 185: .El
1.7 millert 186: .Sh SEE ALSO
187: .Xr yyfix 1
1.1 deraadt 188: .Sh STANDARDS
189: The
1.10 aaron 190: .Nm
1.1 deraadt 191: utility conforms to
192: .St -p1003.2 .