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