Commit | Line | Data |
---|---|---|
f3ace67d | 1 | .\" Copyright (c) 1989, 1990 The Regents of the University of California. |
c89a75cf KB |
2 | .\" All rights reserved. |
3 | .\" | |
4 | .\" This code is derived from software contributed to Berkeley by | |
5 | .\" Robert Paul Corbett. | |
6 | .\" | |
f3ace67d | 7 | .\" %sccs.include.redist.roff% |
c89a75cf | 8 | .\" |
a023ab7e | 9 | .\" @(#)yacc.1 5.7 (Berkeley) %G% |
c89a75cf | 10 | .\" |
f3ace67d CL |
11 | .Dd |
12 | .Dt YACC 1 | |
13 | .Os | |
14 | .Sh NAME | |
15 | .Nm yacc | |
16 | .Nd an | |
17 | .Tn LALR(1) | |
18 | parser generator | |
19 | .Sh SYNOPSIS | |
20 | .Nm yacc | |
21 | .Op Fl dlrtv | |
22 | .Op Fl b Ar prefix | |
23 | .Ar filename | |
24 | .Sh DESCRIPTION | |
25 | .Nm Yacc | |
c89a75cf | 26 | reads the grammar specification in the file |
f3ace67d CL |
27 | .Ar filename |
28 | and generates an | |
29 | .Tn LR(1) | |
30 | parser for it. | |
31 | The parsers consist of a set of | |
32 | .Tn LALR(1) | |
33 | parsing tables and a driver routine | |
c89a75cf | 34 | written in the C programming language. |
f3ace67d | 35 | .Nm Yacc |
c89a75cf | 36 | normally writes the parse tables and the driver routine to the file |
f3ace67d CL |
37 | .Pa y.tab.c . |
38 | .Pp | |
c89a75cf | 39 | The following options are available: |
f3ace67d CL |
40 | .Bl -tag -width Ar |
41 | .It Fl b Ar prefix | |
c89a75cf | 42 | The |
f3ace67d | 43 | .Fl b |
c89a75cf KB |
44 | option changes the prefix prepended to the output file names to |
45 | the string denoted by | |
f3ace67d | 46 | .Ar prefix . |
c89a75cf | 47 | The default prefix is the character |
f3ace67d CL |
48 | .Ar y . |
49 | .It Fl d | |
50 | The | |
51 | .Fl d | |
52 | option causes the header file | |
53 | .Pa y.tab.h | |
c89a75cf | 54 | to be written. |
f3ace67d | 55 | .It Fl l |
c89a75cf | 56 | If the |
f3ace67d | 57 | .Fl l |
c89a75cf | 58 | option is not specified, |
f3ace67d | 59 | .Nm yacc |
c89a75cf KB |
60 | will insert \#line directives in the generated code. |
61 | The \#line directives let the C compiler relate errors in the | |
62 | generated code to the user's original code. | |
f3ace67d CL |
63 | If the |
64 | .Fl l | |
65 | option is specified, | |
66 | .Nm yacc | |
c89a75cf | 67 | will not insert the \#line directives. |
42ddc0cc | 68 | \&\#line directives specified by the user will be retained. |
f3ace67d | 69 | .It Fl r |
42ddc0cc | 70 | The |
f3ace67d | 71 | .Fl r |
42ddc0cc | 72 | option causes |
f3ace67d | 73 | .Nm yacc |
42ddc0cc BC |
74 | to produce separate files for code and tables. |
75 | The code file is named | |
f3ace67d | 76 | .Pa y.code.c , |
42ddc0cc | 77 | and the tables file is named |
f3ace67d CL |
78 | .Pa y.tab.c . |
79 | .It Fl t | |
c89a75cf | 80 | The |
f3ace67d | 81 | .Fl t |
42ddc0cc | 82 | option changes the preprocessor directives generated by |
f3ace67d | 83 | .Nm yacc |
c89a75cf | 84 | so that debugging statements will be incorporated in the compiled code. |
f3ace67d | 85 | .It Fl v |
c89a75cf | 86 | The |
f3ace67d | 87 | .Fl v |
c89a75cf KB |
88 | option causes a human-readable description of the generated parser to |
89 | be written to the file | |
f3ace67d CL |
90 | .Pa y.output . |
91 | .Pp | |
92 | .Sh ENVIRONMENT | |
93 | The following environment variable is referenced by | |
94 | .Nm yacc : | |
95 | .Bl -tag -width TMPDIR | |
96 | .It Ev TMPDIR | |
97 | If the environment variable | |
98 | .Ev TMPDIR | |
99 | is set, the string denoted by | |
100 | .Ev TMPDIR | |
101 | will be used as the name of the directory where the temporary | |
c89a75cf | 102 | files are created. |
f3ace67d CL |
103 | .El |
104 | .Sh TABLES | |
fd572324 | 105 | The names of the tables generated by this version of |
f3ace67d CL |
106 | .Nm yacc |
107 | are | |
108 | .Dq yylhs , | |
109 | .Dq yylen , | |
110 | .Dq yydefred , | |
111 | .Dq yydgoto , | |
112 | .Dq yysindex , | |
113 | .Dq yyrindex , | |
114 | .Dq yygindex , | |
115 | .Dq yytable , | |
116 | and | |
117 | .Dq yycheck . | |
118 | Two additional tables, | |
119 | .Dq yyname | |
120 | and | |
121 | .Dq yyrule , | |
122 | are created if | |
123 | .Dv YYDEBUG | |
124 | is defined and non-zero. | |
125 | .Sh FILES | |
a023ab7e | 126 | .Bl -tag -width /tmp/yacc.uXXXXXXXX -compact |
f3ace67d CL |
127 | .It Pa y.code.c |
128 | .It Pa y.tab.c | |
129 | .It Pa y.tab.h | |
130 | .It Pa y.output | |
131 | .It Pa /tmp/yacc.aXXXXXX | |
132 | .It Pa /tmp/yacc.tXXXXXX | |
133 | .It Pa /tmp/yacc.uXXXXXX | |
134 | .El | |
135 | .Sh DIAGNOSTICS | |
c89a75cf | 136 | If there are rules that are never reduced, the number of such rules is |
f3ace67d CL |
137 | written to the standard error. |
138 | If there are any | |
139 | .Tn LALR(1) | |
140 | conflicts, the number of conflicts is also written | |
141 | to the standard error. | |
142 | .Sh SEE ALSO | |
143 | .Xr yyfix 1 | |
144 | .Sh STANDARDS | |
145 | The | |
146 | .Nm yacc | |
147 | utility conforms to | |
148 | .St -p1003.2 . |