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