BSD 4_3_Reno release
[unix-history] / usr / src / old / yacc / yacc.1
CommitLineData
95f51977 1.\" @(#)yacc.1 6.1 (Berkeley) 4/29/85
f1af6e88 2.\"
95f51977 3.TH YACC 1 "April 29, 1985"
f1af6e88
KM
4.AT 3
5.SH NAME
6yacc \- yet another compiler-compiler
7.SH SYNOPSIS
8.B yacc
9[
10.B \-vd
11]
12grammar
13.SH DESCRIPTION
14.I Yacc
15converts a context-free grammar into a set of
16tables for a simple automaton which executes an LR(1) parsing
17algorithm.
18The grammar may be ambiguous;
19specified precedence rules are used to break ambiguities.
20.PP
21The output file,
22.IR y.tab.c ,
23must be compiled by the C compiler
24to produce a program
25.IR yyparse .
26This program must be loaded with the lexical analyzer program,
27.IR yylex ,
28as well as
29.I main
30and
31.IR yyerror ,
32an error handling routine.
33These routines must be supplied by the user;
34.IR Lex (1)
35is useful for creating lexical analyzers usable by
36.IR yacc .
37.PP
38If the
39.B \-v
40flag is given, the file
41.I y.output
42is prepared, which contains a description of the parsing tables
43and a report on
44conflicts generated by ambiguities in the grammar.
45.PP
46If the \-\fBd\fR flag is used, the file
47.I y.tab.h
48is generated with the
49.I define
50statements that associate the
51.I yacc\c
52-assigned `token codes' with the user-declared `token names'.
53This allows source files other than
54.I y.tab.c
55to access the token codes.
56.SH FILES
57.ta \w'yacc.tmp, yacc.acts 'u
58y.output
59.br
60y.tab.c
61.br
62y.tab.h defines for token names
63.br
64yacc.tmp, yacc.acts temporary files
65.br
66/usr/lib/yaccpar parser prototype for C programs
67.SH "SEE ALSO"
68.IR lex (1)
69.br
70.I "LR Parsing"
71by A. V. Aho and S. C. Johnson,
72Computing Surveys, June, 1974.
73.br
74.I "YACC \- Yet Another Compiler Compiler"
75by S. C. Johnson.
76.SH DIAGNOSTICS
77The number of reduce-reduce and shift-reduce conflicts
78is reported on the standard output;
79a more detailed report is
80found in the
81.I y.output
82file.
83Similarly, if some rules are not reachable from the
84start symbol, this is also reported.
85.SH BUGS
86Because file names are fixed, at most one
87.I yacc
88process can be active in a given directory at
89a time.