'\"macro stdmacro
.if n .pH g1.yacc @(#)yacc	40.14 of 10/30/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} yacc 1 "Extended Software Generation System Utilities" "\&"
.if \nX=1 .ds x} yacc 1 "Extended Software Generation System Utilities"
.if \nX=2 .ds x} yacc 1 "" "\&"
.if \nX=3 .ds x} yacc "" "" "\&"
.TH \*(x}
.SH NAME
\f4yacc\f1 \- yet another compiler-compiler
.SH SYNOPSIS
\f4yacc
[\f4\-vVdlt]
[\f4\-Q\f4[y|n]] \f2file\f1
.SH DESCRIPTION
The
\f4yacc\fP
command converts a context-free grammar into a set of
tables for a simple automaton that executes an
.SM LALR(1)
parsing
algorithm.
The grammar may be ambiguous;
specified precedence rules are used to break ambiguities.
.PP
The output file,
\f4y.tab.c\f1,
must be compiled by the C compiler
to produce a program
\f4yyparse\fP.
This program must be loaded with the lexical analyzer program,
\f4yylex\fP,
as well as
\f4main\fP
and
\f4yyerror\fP,
an error handling routine.
These routines must be supplied by the user;
the \f4lex\f1(1) command
is useful for creating lexical analyzers usable by
\f4yacc\fP.
.PP
.TP 9
\f4\-v\f1
Prepares the file
\f4y.output\fP,
which contains a description of the parsing tables
and a report on
conflicts generated by ambiguities in the grammar.
.PP
.TP 9
\-\f4d\f1
Generates the file
\f4y.tab.h\f1
with the
\f4#define\f1
statements that associate the
\f4yacc\fP\c
-assigned ``token codes'' with the user-declared ``token names.''
This association allows source files other than
\f4y.tab.c\f1
to access the token codes.
.PP
.TP 9
\f4\-l\f1
Specifies that the code produced in
\f4y.tab.c\f1
will not contain any
\f4#line\f1
constructs.  This option should only be used after the
grammar and the associated actions are fully debugged.
.TP 9
\f4\-Q\f1[\f4y\f1|\f4n\f1]
The \f4\-Qy\fP option puts the version stamping information in \f4y.tab.c\fP.
This allows you to know what version of \f4yacc\f1 built the file.
The \f4\-Qn\fP option (the default) writes no version information.
.TP 9
\f4\-t\f1
Compiles runtime debugging code by default.
Runtime debugging code is always generated in
\f4y.tab.c\f1
under conditional compilation control.
By default, this code is not included when
\f4y.tab.c\f1
is compiled.
Whether or not the
\f4\-t\f1
option is used, the runtime debugging code is under the control of
\f4YYDEBUG\f1,
a preprocessor symbol.
If
\f4YYDEBUG\f1
has a non-zero value, then the debugging code is included.
If its value is zero, then the code will not be included.
The size and execution time of a program produced without the
runtime debugging code will be smaller and slightly faster.
.TP 9
\f4\-V\f1
Prints on the standard error output
the version information for \f4yacc\f1.
.SH FILES
.PD 0
.TP 2.0i
\f4y.output\f1
.TP
\f4y.tab.c\f1
.TP
\f4y.tab.h\f1
defines for token names
.TP
\f4yacc.tmp,\f1
.TP
\f4yacc.debug, yacc.acts\f1
temporary files
.TP
\f2LIBDIR\f4/yaccpar\f1
parser prototype for C programs
.sp .2
.TP
\f2LIBDIR\f1
usually \f4/usr/ccs/lib\f1
.SH "SEE ALSO"
\f4lex\fP(1).
.br
The
``\f4yacc\f1''
chapter in the
\f2Programmer's Guide: ANSI C and Programming Support Tools\f1.
.SH DIAGNOSTICS
The number of reduce-reduce and shift-reduce conflicts
is reported on the standard error output;
a more detailed report is
found in the
\f4y.output\f1
file.
Similarly, if some rules are not reachable from the
start symbol, this instance is also reported.
.SH NOTES
Because file names are fixed, at most one
\f4yacc\fP
process can be active in a given directory at
a given time.
.\"	@(#)yacc.1	6.2 of 9/2/83
.Ee
