Commit | Line | Data |
---|---|---|
c89a75cf KB |
1 | .\" Copyright (c) 1989 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" This code is derived from software contributed to Berkeley by | |
5 | .\" Robert Paul Corbett. | |
6 | .\" | |
0fc6e47b | 7 | .\" %sccs.include.redist.man% |
c89a75cf | 8 | .\" |
0fc6e47b | 9 | .\" @(#)yacc.1 5.5 (Berkeley) %G% |
c89a75cf KB |
10 | .\" |
11 | .TH YACC 1 "" | |
12 | .UC 7 | |
13 | .SH NAME | |
14 | yacc \- an LALR(1) parser generator | |
15 | .SH SYNOPSIS | |
42ddc0cc | 16 | .B yacc [ -dlrtv ] [ -b |
c89a75cf KB |
17 | .I prefix |
18 | .B ] | |
19 | .I filename | |
20 | .SH DESCRIPTION | |
21 | .I Yacc | |
22 | reads the grammar specification in the file | |
23 | .I filename | |
24 | and generates an LR(1) parser for it. | |
25 | The parsers consist of a set of LALR(1) parsing tables and a driver routine | |
26 | written in the C programming language. | |
27 | .I Yacc | |
28 | normally writes the parse tables and the driver routine to the file | |
29 | .IR y.tab.c. | |
30 | .PP | |
31 | The following options are available: | |
32 | .RS | |
33 | .TP | |
34 | \fB-b \fIprefix\fR | |
35 | The | |
36 | .B -b | |
37 | option changes the prefix prepended to the output file names to | |
38 | the string denoted by | |
39 | .IR prefix. | |
40 | The default prefix is the character | |
41 | .IR y. | |
42 | .TP | |
43 | .B -d | |
44 | The \fB-d\fR option causes the header file | |
45 | .IR y.tab.h | |
46 | to be written. | |
47 | .TP | |
48 | .B -l | |
49 | If the | |
50 | .B -l | |
51 | option is not specified, | |
52 | .I yacc | |
53 | will insert \#line directives in the generated code. | |
54 | The \#line directives let the C compiler relate errors in the | |
55 | generated code to the user's original code. | |
56 | If the \fB-l\fR option is specified, | |
57 | .I yacc | |
58 | will not insert the \#line directives. | |
42ddc0cc BC |
59 | \&\#line directives specified by the user will be retained. |
60 | .TP | |
61 | .B -r | |
62 | The | |
63 | .B -r | |
64 | option causes | |
65 | .I yacc | |
66 | to produce separate files for code and tables. | |
67 | The code file is named | |
68 | .IR y.code.c, | |
69 | and the tables file is named | |
70 | .IR y.tab.c. | |
c89a75cf KB |
71 | .TP |
72 | .B -t | |
73 | The | |
74 | .B -t | |
42ddc0cc | 75 | option changes the preprocessor directives generated by |
c89a75cf KB |
76 | .I yacc |
77 | so that debugging statements will be incorporated in the compiled code. | |
78 | .TP | |
79 | .B -v | |
80 | The | |
81 | .B -v | |
82 | option causes a human-readable description of the generated parser to | |
83 | be written to the file | |
84 | .IR y.output. | |
85 | .RE | |
86 | .PP | |
87 | If the environment variable TMPDIR is set, the string denoted by | |
88 | TMPDIR will be used as the name of the directory where the temporary | |
89 | files are created. | |
fd572324 | 90 | .SH TABLES |
fd572324 KB |
91 | The names of the tables generated by this version of |
92 | .I yacc | |
93 | are ``yylhs'', ``yylen'', ``yydefred'', ``yydgoto'', ``yysindex'', | |
94 | ``yyrindex'', ``yygindex'', ``yytable'', and ``yycheck''. | |
95 | Two additional tables, ``yyname'' and ``yyrule'', are created if | |
96 | YYDEBUG is defined and non-zero. | |
c89a75cf | 97 | .SH FILES |
42ddc0cc BC |
98 | .IR y.code.c |
99 | .br | |
c89a75cf KB |
100 | .IR y.tab.c |
101 | .br | |
102 | .IR y.tab.h | |
103 | .br | |
104 | .IR y.output | |
105 | .br | |
106 | .IR /tmp/yacc.aXXXXXX | |
107 | .br | |
108 | .IR /tmp/yacc.tXXXXXX | |
109 | .br | |
110 | .IR /tmp/yacc.uXXXXXX | |
42e8df0f KB |
111 | .SH "SEE ALSO" |
112 | yyfix(1) | |
c89a75cf KB |
113 | .SH DIAGNOSTICS |
114 | If there are rules that are never reduced, the number of such rules is | |
115 | reported on standard error. | |
116 | If there are any LALR(1) conflicts, the number of conflicts is reported | |
117 | on standard error. |