yacc.1 (5150B)
1 .\" 2 .\" Sccsid @(#)yacc.1 1.5 (gritter) 11/27/05 3 .\" Derived from yacc(1), Unix 7th edition: 4 .\" Copyright(C) Caldera International Inc. 2001-2002. All rights reserved. 5 .\" 6 .\" Redistribution and use in source and binary forms, with or without 7 .\" modification, are permitted provided that the following conditions 8 .\" are met: 9 .\" Redistributions of source code and documentation must retain the 10 .\" above copyright notice, this list of conditions and the following 11 .\" disclaimer. 12 .\" Redistributions in binary form must reproduce the above copyright 13 .\" notice, this list of conditions and the following disclaimer in the 14 .\" documentation and/or other materials provided with the distribution. 15 .\" All advertising materials mentioning features or use of this software 16 .\" must display the following acknowledgement: 17 .\" This product includes software developed or owned by Caldera 18 .\" International, Inc. 19 .\" Neither the name of Caldera International, Inc. nor the names of 20 .\" other contributors may be used to endorse or promote products 21 .\" derived from this software without specific prior written permission. 22 .\" 23 .\" USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA 24 .\" INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR 25 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 26 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 .\" ARE DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE 28 .\" LIABLE FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR 29 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 30 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 31 .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 32 .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 33 .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 34 .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 .\" 36 .TH YACC 1 "11/27/05" "Heirloom Development Tools" "User Commands" 37 .SH NAME 38 yacc \- yet another compiler-compiler 39 .SH SYNOPSIS 40 .HP 41 .ad l 42 .nh 43 \fByacc\fR [\fB\-vVdlt\fR] [\fB\-Q\fR(\fBy\fR|\fBn\fR)] 44 [\fB\-b\ \fIfile_prefix\fR] [\fB\-p\ \fIsym_prefix\fR] [\fB\-P\ \fIparser\fR] 45 [\fB\-Y\ \fIdirectory\fR] 46 \fIgrammar\fR 47 .br 48 .ad b 49 .SH DESCRIPTION 50 .I Yacc 51 converts a context-free grammar into a set of 52 tables for a simple automaton which executes an LR(1) parsing 53 algorithm. 54 The grammar may be ambiguous; 55 specified precedence rules are used to break ambiguities. 56 .PP 57 The output file, 58 .IR y.tab.c , 59 must be compiled by the C compiler 60 to produce a program 61 .IR yyparse . 62 This program must be loaded with the lexical analyzer program, 63 .IR yylex , 64 as well as 65 .I main 66 and 67 .IR yyerror , 68 an error handling routine. 69 These routines must be supplied by the user; 70 .IR Lex (1) 71 is useful for creating lexical analyzers usable by 72 .IR yacc . 73 .PP 74 The following options are accepted: 75 .TP 76 \fB\-b\ \fIfile_prefix\fR 77 Use 78 .I file_prefix 79 instead of `y' 80 when generating output files, 81 i.\|e. generate `\fIfile_prefix\fR.tab.c' and so forth. 82 This option was introduced by POSIX.2. 83 .TP 84 .B \-d 85 If this option is used, the file 86 .I y.tab.h 87 is generated with the 88 .I define 89 statements that associate the 90 \fIyacc\fR-assigned `token codes' with the user-declared `token names'. 91 This allows source files other than 92 .I y.tab.c 93 to access the token codes. 94 .TP 95 .B \-l 96 Do not emit `#line' preprocessor directives when writing 97 .IR y.tab.c . 98 These are normally inserted to facilitate debugging. 99 .TP 100 \fB\-p\ \fIsym_prefix\fR 101 Use 102 .I sym_prefix 103 instead of `yy' as the prefix for names with global scope, 104 i.\|e. generate `\fIsym_prefix\fRparse' and so forth. 105 This option was introduced by POSIX.2. 106 .TP 107 \fB\-P\ \fIdriver_file\fR 108 Use the file 109 .I driver_file 110 as driver file instead of `yaccpar'. 111 .TP 112 \fB\-Q\fR(\fBy\fR|\fBn\fR) 113 With 114 .BR \-Qy , 115 a version identification variable is put into y.tab.c. 116 With 117 .B \-Qn 118 (the default), no such variable is generated. 119 .TP 120 .B \-t 121 Enable run-time debugging code by default, 122 i.\|e. define the `YYDEBUG' preprocessor symbol. 123 .TP 124 .B \-v 125 If this option is given, the file 126 .I y.output 127 is prepared, which contains a description of the parsing tables 128 and a report on 129 conflicts generated by ambiguities in the grammar. 130 .TP 131 .B \-V 132 Causes version information for 133 .I yacc 134 to be printed. 135 .TP 136 \fB\-Y \fIdirectory\fR 137 Use the file `\fIdirectory\fR/yaccpar' as driver file. 138 This option is an extension. 139 .SH FILES 140 .ta \w'/usr/ccs/lib/yaccpar 'u 141 y.output 142 .br 143 y.tab.c 144 .br 145 y.tab.h defines for token names 146 .br 147 yacc.tmp, yacc.acts temporary files 148 .br 149 /usr/ccs/lib/yaccpar parser prototype for C programs 150 .br 151 /usr/ccs/lib/liby.a library with default `main' and `yyerror' 152 .SH "SEE ALSO" 153 .IR lex (1) 154 .br 155 .I "LR Parsing" 156 by A. V. Aho and S. C. Johnson, 157 Computing Surveys, June, 1974. 158 .br 159 .I "YACC \- Yet Another Compiler Compiler" 160 by S. C. Johnson. 161 .SH DIAGNOSTICS 162 The number of reduce-reduce and shift-reduce conflicts 163 is reported on the standard output; 164 a more detailed report is 165 found in the 166 .I y.output 167 file. 168 Similarly, if some rules are not reachable from the 169 start symbol, this is also reported.