.\" .\" Sccsid @(#)yacc.1 1.5 (gritter) 11/27/05 .\" Derived from yacc(1), Unix 7th edition: .\" Copyright(C) Caldera International Inc. 2001-2002. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" Redistributions of source code and documentation must retain the .\" above copyright notice, this list of conditions and the following .\" disclaimer. .\" Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed or owned by Caldera .\" International, Inc. .\" Neither the name of Caldera International, Inc. nor the names of .\" other contributors may be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA .\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE .\" LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .TH YACC 1 "11/27/05" "Heirloom Development Tools" "User Commands" .SH NAME yacc \- yet another compiler-compiler .SH SYNOPSIS .HP .ad l .nh \fByacc\fR [\fB\-vVdlt\fR] [\fB\-Q\fR(\fBy\fR|\fBn\fR)] [\fB\-b\ \fIfile_prefix\fR] [\fB\-p\ \fIsym_prefix\fR] [\fB\-P\ \fIparser\fR] [\fB\-Y\ \fIdirectory\fR] \fIgrammar\fR .br .ad b .SH DESCRIPTION .I Yacc converts a context-free grammar into a set of tables for a simple automaton which executes an LR(1) parsing algorithm. The grammar may be ambiguous; specified precedence rules are used to break ambiguities. .PP The output file, .IR y.tab.c , must be compiled by the C compiler to produce a program .IR yyparse . This program must be loaded with the lexical analyzer program, .IR yylex , as well as .I main and .IR yyerror , an error handling routine. These routines must be supplied by the user; .IR Lex (1) is useful for creating lexical analyzers usable by .IR yacc . .PP The following options are accepted: .TP \fB\-b\ \fIfile_prefix\fR Use .I file_prefix instead of `y' when generating output files, i.\|e. generate `\fIfile_prefix\fR.tab.c' and so forth. This option was introduced by POSIX.2. .TP .B \-d If this option is used, the file .I y.tab.h is generated with the .I define statements that associate the \fIyacc\fR-assigned `token codes' with the user-declared `token names'. This allows source files other than .I y.tab.c to access the token codes. .TP .B \-l Do not emit `#line' preprocessor directives when writing .IR y.tab.c . These are normally inserted to facilitate debugging. .TP \fB\-p\ \fIsym_prefix\fR Use .I sym_prefix instead of `yy' as the prefix for names with global scope, i.\|e. generate `\fIsym_prefix\fRparse' and so forth. This option was introduced by POSIX.2. .TP \fB\-P\ \fIdriver_file\fR Use the file .I driver_file as driver file instead of `yaccpar'. .TP \fB\-Q\fR(\fBy\fR|\fBn\fR) With .BR \-Qy , a version identification variable is put into y.tab.c. With .B \-Qn (the default), no such variable is generated. .TP .B \-t Enable run-time debugging code by default, i.\|e. define the `YYDEBUG' preprocessor symbol. .TP .B \-v If this option is given, the file .I y.output is prepared, which contains a description of the parsing tables and a report on conflicts generated by ambiguities in the grammar. .TP .B \-V Causes version information for .I yacc to be printed. .TP \fB\-Y \fIdirectory\fR Use the file `\fIdirectory\fR/yaccpar' as driver file. This option is an extension. .SH FILES .ta \w'/usr/ccs/lib/yaccpar 'u y.output .br y.tab.c .br y.tab.h defines for token names .br yacc.tmp, yacc.acts temporary files .br /usr/ccs/lib/yaccpar parser prototype for C programs .br /usr/ccs/lib/liby.a library with default `main' and `yyerror' .SH "SEE ALSO" .IR lex (1) .br .I "LR Parsing" by A. V. Aho and S. C. Johnson, Computing Surveys, June, 1974. .br .I "YACC \- Yet Another Compiler Compiler" by S. C. Johnson. .SH DIAGNOSTICS The number of reduce-reduce and shift-reduce conflicts is reported on the standard output; a more detailed report is found in the .I y.output file. Similarly, if some rules are not reachable from the start symbol, this is also reported.