.th YACC I 11/25/74 .sh NAME yacc \*- yet another compiler-compiler .sh SYNOPSIS .bd yacc [ .bd \*-vor ] [ 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 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 \*-o flag calls an optimizer for the tables; the optimized tables, with parser included, appear on file .it y.tab.c .s3 The .bd \*-r flag causes Yacc to accept grammars with Ratfor actions, and produce Ratfor output on .it y.tab.r; .bd \*-r implies the .bd \*-o flag. Typical usage is then .s3 rc y.tab.r other.o .s3 .sh "SEE ALSO" ``LR Parsing'', by A. V. Aho and S. C. Johnson, Computing Surveys, June, 1974. ``The YACC Compiler-compiler'', internal memorandum. .sh AUTHOR S. C. Johnson .sh FILES y.output .br y.tab.c .br y.tab.r when ratfor output is obtained .br yacc.tmp when optimizer is called .br /lib/liby.a runtime library for compiler .br /usr/yacc/fpar.r ratfor parser .br /usr/yacc/opar.c parser for optimized tables .br /usr/yacc/yopti optimizer postpass .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 Yacc process can be active in a given directory at a time.