add argument/usage message, correct exit status
[unix-history] / usr / src / usr.bin / yacc / yacc.1
CommitLineData
c89a75cf
KB
1.\" Copyright (c) 1989 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Robert Paul Corbett.
6.\"
7.\" Redistribution and use in source and binary forms are permitted
8.\" provided that the above copyright notice and this paragraph are
9.\" duplicated in all such forms and that any documentation,
10.\" advertising materials, and other materials related to such
11.\" distribution and use acknowledge that the software was developed
12.\" by the University of California, Berkeley. The name of the
13.\" University may not be used to endorse or promote products derived
14.\" from this software without specific prior written permission.
15.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
16.\" IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
17.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
18.\"
42e8df0f 19.\" @(#)yacc.1 5.3 (Berkeley) %G%
c89a75cf
KB
20.\"
21.TH YACC 1 ""
22.UC 7
23.SH NAME
24yacc \- an LALR(1) parser generator
25.SH SYNOPSIS
26.B yacc [ -dltv ] [ -b
27.I prefix
28.B ]
29.I filename
30.SH DESCRIPTION
31.I Yacc
32reads the grammar specification in the file
33.I filename
34and generates an LR(1) parser for it.
35The parsers consist of a set of LALR(1) parsing tables and a driver routine
36written in the C programming language.
37.I Yacc
38normally writes the parse tables and the driver routine to the file
39.IR y.tab.c.
40.PP
41The following options are available:
42.RS
43.TP
44\fB-b \fIprefix\fR
45The
46.B -b
47option changes the prefix prepended to the output file names to
48the string denoted by
49.IR prefix.
50The default prefix is the character
51.IR y.
52.TP
53.B -d
54The \fB-d\fR option causes the header file
55.IR y.tab.h
56to be written.
57.TP
58.B -l
59If the
60.B -l
61option is not specified,
62.I yacc
63will insert \#line directives in the generated code.
64The \#line directives let the C compiler relate errors in the
65generated code to the user's original code.
66If the \fB-l\fR option is specified,
67.I yacc
68will not insert the \#line directives.
69Any \#line directives specified by the user will be retained.
70.TP
71.B -t
72The
73.B -t
74option will change the preprocessor directives generated by
75.I yacc
76so that debugging statements will be incorporated in the compiled code.
77.TP
78.B -v
79The
80.B -v
81option causes a human-readable description of the generated parser to
82be written to the file
83.IR y.output.
84.RE
85.PP
86If the environment variable TMPDIR is set, the string denoted by
87TMPDIR will be used as the name of the directory where the temporary
88files are created.
fd572324 89.SH TABLES
fd572324
KB
90The names of the tables generated by this version of
91.I yacc
92are ``yylhs'', ``yylen'', ``yydefred'', ``yydgoto'', ``yysindex'',
93``yyrindex'', ``yygindex'', ``yytable'', and ``yycheck''.
94Two additional tables, ``yyname'' and ``yyrule'', are created if
95YYDEBUG is defined and non-zero.
c89a75cf
KB
96.SH FILES
97.IR y.tab.c
98.br
99.IR y.tab.h
100.br
101.IR y.output
102.br
103.IR /tmp/yacc.aXXXXXX
104.br
105.IR /tmp/yacc.tXXXXXX
106.br
107.IR /tmp/yacc.uXXXXXX
42e8df0f
KB
108.SH "SEE ALSO"
109yyfix(1)
c89a75cf
KB
110.SH DIAGNOSTICS
111If there are rules that are never reduced, the number of such rules is
112reported on standard error.
113If there are any LALR(1) conflicts, the number of conflicts is reported
114on standard error.