.TH YACC 1
.SH NAME
yacc \- yet another compiler-compiler
.SH SYNOPSIS
.B yacc
[
.I option ...
]
.I grammar
.SH DESCRIPTION
.I Yacc
converts a context-free grammar and translation code
into a set of
tables for an LR(1) parser and translator.
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
.LR yyparse .
This program must be loaded with a lexical analyzer function,
.B yylex(void)
(often generated by
.IR lex (1)),
with a
.B main(int argc, char *argv[])
program, and with an error handling routine,
.BR yyerror(char*) .
.PP
The options are
.TP "\w'\fL-o \fIoutput\fLXX'u"
.BI -o " output
Direct output to the specified file instead of
.BR y.tab.c.
.TP
.BI -D n
Create file
.BR y.debug ,
containing diagnostic messages.
The amount of 
diagnostic output from the parser is regulated by
value
.IR n :
.RS 
.TP
0
Report errors.
.TP
1
Also report reductions.
.TP
2
Also report the name of each token returned by
.LR yylex .
.RE
.TP
.B -v
Create file
.BR y.output ,
containing a description of the parsing tables and of
conflicts arising from ambiguities in the grammar.
.TP
.B -d
Create file
.BR y.tab.h ,
containing
.B #define
statements that associate
.IR yacc -assigned
`token codes' with user-declared `token names'.
Include it in source files other than
.B y.tab.c
to give access to the token codes.
.TP
.BI -s " stem
Change the prefix
.L y 
of the file names
.BR y.tab.c ,
.BR y.tab.h ,
.BR y.debug ,
and
.B y.output
to
.I stem.
.TP
.B -S
Write a parser that uses
.I stdio
instead of the
.I print
routines in libc.
.SH FILES
.TF /sys/lib/yaccpars
.TP
.B y.output
.TP
.B y.tab.c
.TP
.B y.tab.h
.TP
.B y.debug
.TP
.B y.tmp.*
temporary file
.TP
.B y.acts.*
temporary file
.TP
.B /sys/lib/yaccpar
parser prototype
.TP
.B /sys/lib/yaccpars
parser prototype using stdio
.SH "SEE ALSO"
.IR lex (1)
.br
.I
Yacc: A parser generator,
S. C. Johnson and R. Sethi,
Unix Research System Programmer's Manual, Volume 2
.SH BUGS
The parser may not have full information when it writes to
.B y.debug
so that the names of the tokens returned by
.L yylex
may be missing.
