This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / usr.bin / yacc / yacc.1
CommitLineData
78ed81a3 1.\" %W% %R% (Berkeley) %E%
15637ed4 2.\"
78ed81a3 3.TH YACC 1 "July\ 15,\ 1990"
4.UC 6
5.SH NAME
6Yacc \- an LALR(1) parser generator
7.SH SYNOPSIS
8.B yacc [ -dlrtv ] [ -b
9.I file_prefix
10.B ] [ -p
11.I symbol_prefix
12.B ]
13.I filename
14.SH DESCRIPTION
15.I Yacc
15637ed4 16reads the grammar specification in the file
78ed81a3 17.I filename
18and generates an LR(1) parser for it.
19The parsers consist of a set of LALR(1) parsing tables and a driver routine
15637ed4 20written in the C programming language.
78ed81a3 21.I Yacc
15637ed4 22normally writes the parse tables and the driver routine to the file
78ed81a3 23.IR y.tab.c.
24.PP
15637ed4 25The following options are available:
78ed81a3 26.RS
27.TP
28\fB-b \fIfile_prefix\fR
15637ed4 29The
78ed81a3 30.B -b
15637ed4
RG
31option changes the prefix prepended to the output file names to
32the string denoted by
78ed81a3 33.IR file_prefix.
15637ed4 34The default prefix is the character
78ed81a3 35.IR y.
36.TP
37.B -d
38The \fB-d\fR option causes the header file
39.IR y.tab.h
15637ed4 40to be written.
78ed81a3 41.TP
42.B -l
15637ed4 43If the
78ed81a3 44.B -l
15637ed4 45option is not specified,
78ed81a3 46.I yacc
15637ed4
RG
47will insert \#line directives in the generated code.
48The \#line directives let the C compiler relate errors in the
49generated code to the user's original code.
78ed81a3 50If the \fB-l\fR option is specified,
51.I yacc
15637ed4
RG
52will not insert the \#line directives.
53\&\#line directives specified by the user will be retained.
78ed81a3 54.TP
55\fB-p \fIsymbol_prefix\fR
56The
57.B -p
58option changes the prefix prepended to yacc-generated symbols to
59the string denoted by
60.IR symbol_prefix.
61The default prefix is the string
62.IR yy.
63.TP
64.B -r
15637ed4 65The
78ed81a3 66.B -r
15637ed4 67option causes
78ed81a3 68.I yacc
69to produce separate files for code and tables. The code file
70is named
71.IR y.code.c,
15637ed4 72and the tables file is named
78ed81a3 73.IR y.tab.c.
74.TP
75.B -t
15637ed4 76The
78ed81a3 77.B -t
15637ed4 78option changes the preprocessor directives generated by
78ed81a3 79.I yacc
15637ed4 80so that debugging statements will be incorporated in the compiled code.
78ed81a3 81.TP
82.B -v
15637ed4 83The
78ed81a3 84.B -v
15637ed4
RG
85option causes a human-readable description of the generated parser to
86be written to the file
78ed81a3 87.IR y.output.
88.RE
89.PP
90If the environment variable TMPDIR is set, the string denoted by
91TMPDIR will be used as the name of the directory where the temporary
15637ed4 92files are created.
78ed81a3 93.SH FILES
94.IR y.code.c
95.br
96.IR y.tab.c
97.br
98.IR y.tab.h
99.br
100.IR y.output
101.br
102.IR /tmp/yacc.aXXXXXX
103.br
104.IR /tmp/yacc.tXXXXXX
105.br
106.IR /tmp/yacc.uXXXXXX
107.SH DIAGNOSTICS
15637ed4 108If there are rules that are never reduced, the number of such rules is
78ed81a3 109reported on standard error.
110If there are any LALR(1) conflicts, the number of conflicts is reported
111on standard error.