.TH YACC 1 .SH NAME yacc \- yet another compiler-compiler .SH SYNOPSIS .B yacc [ .B \-vdlt ] grammar .SH DESCRIPTION .I Yacc\^ converts a context-free grammar into a set of tables for a simple automaton which executes an .SM LR(1) parsing algorithm. The grammar may be ambiguous; specified precedence rules are used to break ambiguities. .PP The output file, .BR 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 If the .B \-v flag is given, the file .B y.output is prepared, which contains a description of the parsing tables and a report on conflicts generated by ambiguities in the grammar. .PP If the \-\fBd\fR flag is used, the file .B y.tab.h is generated with the .B #define statements that associate the .I yacc\c\^ -assigned ``token codes'' with the user-declared ``token names''. This allows source files other than .B y.tab.c to access the token codes. .PP If the .B \-l flag is given, the code produced in .B y.tab.c will \fInot\fR contain any .B #line constructs. This should only be used after the grammar and the associated actions are fully debugged. .PP Runtime debugging code is always generated in .B y.tab.c under conditional compilation control. By default, this code is not included when .B y.tab.c is compiled. However, when .IR yacc 's .B \-t option is used, this debugging code will be compiled by default. Independent of whether the .B \-t option was used, the runtime debugging code is under the control of .BR \s-1YYDEBUG\s+1 , a pre-processor symbol. If .B \s-1YYDEBUG\s+1 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. .SH FILES y.output .br y.tab.c .br y.tab.h defines for token names .br yacc.tmp, .br yacc.debug, yacc.acts temporary files .br /usr/lib/yaccpar parser prototype for C programs .br .SH "SEE ALSO" lex(1). .br .I "\s-1YACC\s+1\-Yet Another Compiler Compiler\^" in the .IR "\s-1UNIX\s+1 System Support Tools Guide" . .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 .B y.output file. Similarly, if some rules are not reachable from the start symbol, this is also reported. .SH BUGS Because file names are fixed, at most one .I yacc\^ process can be active in a given directory at a time. .\" @(#)yacc.1 5.2 of 5/18/82