.th YACC I 5/31/77 .sh NAME yacc \*- yet another compiler-compiler .sh SYNOPSIS .bd yacc [ .bd \*-vrd ] [ grammar ] .sh DESCRIPTION .it 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. .s3 The output is .it y.tab.c, which must be compiled by the C compiler and loaded with any other routines required (perhaps a lexical analyzer) and the .it yacc library: .s3 cc y.tab.c other.o \*-ly .s3 If the .bd \*-v flag is given, the file .it y.output is prepared, which contains a description of the parsing tables and a report on conflicts generated by ambiguities in the grammar. .s3 The .bd \*-r flag causes .it yacc to accept grammars with Ratfor actions, and produce Ratfor output on .it y.tab.r. Typical usage is then .s3 rc y.tab.r other.o .s3 If the \-\fBd\fP flag is used, the file .it y.tab.h is generated with the .it define statements that associate the .it yacc\c -assigned ``token codes'' with the user-declared ``token names''. This allows source files other than .it y.tab.c to access the token codes. .sh "SEE ALSO" lex(I) .br .it "LR Parsing" by A. V. Aho and S. C. Johnson, Computing Surveys, June, 1974. .br .it "YACC \- Yet Another Compiler Compiler" by S. C. Johnson. .sh FILES y.output .br y.tab.c .br y.tab.r when ratfor output is obtained .br y.tab.h defines for token names .br yacc.tmp, yacc.acts temporary files .br /lib/liby.a runtime library for compiler .br /usr/lib/yaccopar parser prototype for C programs .br /usr/lib/yaccrpar parser prototype for Ratfor programs .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 .it y.output file. .sh BUGS Because file names are fixed, at most one .it yacc process can be active in a given directory at a time.