1
2
3
4YACC(1) USER COMMANDS YACC(1)
5
6
7
8NAME
9 Yacc ‐ an LALR(1) parser generator
10
11SYNOPSIS
12 yacc [ ‐dlrtv ] [ ‐b _p_r_e_f_i_x ] _f_i_l_e_n_a_m_e
13
14DESCRIPTION
15 _Y_a_c_c reads the grammar specification in the file _f_i_l_e_n_a_m_e
16 and generates an LR(1) parser for it. The parsers consist
17 of a set of LALR(1) parsing tables and a driver routine
18 written in the C programming language. _Y_a_c_c normally writes
19 the parse tables and the driver routine to the file _y._t_a_b._c.
20
21 The following options are available:
22
23 ‐b _p_r_e_f_i_x
24 The ‐b option changes the prefix prepended to the
25 output file names to the string denoted by _p_r_e_f_i_x.
26 The default prefix is the character _y.
27
28 ‐d The ‐d option causes the header file _y._t_a_b._h to be
29 written.
30
31 ‐l If the ‐l option is not specified, _y_a_c_c will
32 insert #line directives in the generated code.
33 The #line directives let the C compiler relate
34 errors in the generated code to the user’s origi‐
35 nal code. If the ‐l option is specified, _y_a_c_c
36 will not insert the #line directives. #line
37 directives specified by the user will be retained.
38
39 ‐r The ‐r option causes _y_a_c_c to produce separate
40 files for code and tables. The code file is named
41 _y._c_o_d_e._c, and the tables file is named _y._t_a_b._c.
42
43 ‐t The ‐t option changes the preprocessor directives
44 generated by _y_a_c_c so that debugging statements
45 will be incorporated in the compiled code.
46
47 ‐v The ‐v option causes a human‐readable description
48 of the generated parser to be written to the file
49 _y._o_u_t_p_u_t.
50
51 If the environment variable TMPDIR is set, the string
52 denoted by TMPDIR will be used as the name of the directory
53 where the temporary files are created.
54
55FILES
56 _y._c_o_d_e._c
57 _y._t_a_b._c
58 _y._t_a_b._h
59 _y._o_u_t_p_u_t
60
61
62
63Sun Release 4.1 Last change: July 15, 1990 1
64
65
66
67
68
69
70YACC(1) USER COMMANDS YACC(1)
71
72
73
74 /_t_m_p/_y_a_c_c._a_X_X_X_X_X_X
75 /_t_m_p/_y_a_c_c._t_X_X_X_X_X_X
76 /_t_m_p/_y_a_c_c._u_X_X_X_X_X_X
77
78DIAGNOSTICS
79 If there are rules that are never reduced, the number of
80 such rules is reported on standard error. If there are any
81 LALR(1) conflicts, the number of conflicts is reported on
82 standard error.
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129Sun Release 4.1 Last change: July 15, 1990 2
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198