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