1 .\" $Id: yacc.1,v 1.7 2010/02/17 02:01:24 tom Exp $
3 .\" .TH YACC 1 "July\ 15,\ 1990"
5 .TH YACC 1 "February 16, 2010" "Berkeley Yacc" "User Commands"
7 Yacc \- an LALR(1) parser generator
9 .B yacc [ -dglrtv ] [ \-b
17 reads the grammar specification in the file
19 and generates an LALR(1) parser for it.
20 The parsers consist of a set of LALR(1) parsing tables and a driver routine
21 written in the C programming language.
23 normally writes the parse tables and the driver routine to the file
26 The following options are available:
28 \fB\-b \fP\fIfile_prefix\fR
31 option changes the prefix prepended to the output file names to
34 The default prefix is the character
38 The \fB-d\fR option causes the header file
45 option causes a graphical description of the generated LALR(1) parser to
46 be written to the file
48 in graphviz format, ready to be processed by dot(1).
53 option is not specified,
55 will insert \fI#line\fP directives in the generated code.
56 The \fI#line\fP directives let the C compiler relate errors in the
57 generated code to the user's original code.
58 If the \fB-l\fR option is specified,
60 will not insert the \fI#line\fP directives.
61 \&\fI#line\fP directives specified by the user will be retained.
63 \fB\-o \fP\fIoutput_file\fR
64 specify the filename for the parser file.
65 If this option is not given, the output filename is
66 the file prefix concatenated with the file suffix, e.g., \fBy.tab.c\fP.
67 This overrides the \fB-p\fP option.
69 \fB\-p \fP\fIsymbol_prefix\fR
72 option changes the prefix prepended to yacc-generated symbols to
75 The default prefix is the string
79 create a reentrant parser, e.g., "%pure-parser".
86 to produce separate files for code and tables. The code file
89 and the tables file is named
95 option changes the preprocessor directives generated by
97 so that debugging statements will be incorporated in the compiled code.
102 option causes a human-readable description of the generated parser to
103 be written to the file
107 print the version number to the standard output.
110 provides some extensions for compatibility with bison and other implementations
113 \fB %expect\fP \fInumber\fP
114 tell \fByacc\fP the expected number of shift/reduce conflicts.
115 That makes it only report the number if it differs.
117 \fB %expect-rr\fP \fInumber\fP
118 tell \fByacc\fP the expected number of reduce/reduce conflicts.
119 That makes it only report the number if it differs.
120 This is (unlike bison) allowable in LALR parsers.
123 Most variables (other than \fByydebug\fP and \fByynerrs\fP) are
124 allocated on the stack within \fByyparse\fP, making the parser reasonably
128 If there are rules that are never reduced, the number of such rules is
129 reported on standard error.
130 If there are any LALR(1) conflicts, the number of conflicts is reported