]> git.saurik.com Git - bison.git/blob - doc/bison.rnh
(yyparse): Rewrite to avoid "comparison is always true due to limited
[bison.git] / doc / bison.rnh
1 .!
2 .! RUNOFF source file for BISON.HLP
3 .!
4 .! This is a RUNOFF input file which will produce a VMS help file
5 .! for the VMS HELP library.
6 .!
7 .! Eric Youngdale and Wilfred J. Hansen (wjh+@cmu.edu).
8 .!
9 .literal
10 .end literal
11 .no paging
12 .no flags all
13 .right margin 70
14 .left margin 1
15
16 .indent -1
17 1 BISON
18 .skip
19 The BISON command invokes the GNU BISON parser generator.
20 .skip
21 .literal
22 BISON file-spec
23 .end literal
24 .skip
25 .indent -1
26 2 Parameters
27 .skip
28 file-spec
29 .skip
30 Here file-spec is the grammar file name, which usually ends in
31 .y. The parser file's name is made by replacing the .y
32 with _tab.c. Thus, the command bison foo.y yields
33 foo_tab.c.
34
35 .skip
36 .indent -1
37 2 Qualifiers
38 .skip
39 The following is the list of available qualifiers for BISON:
40 .literal
41 /DEBUG
42 /DEFINES
43 /FILE_PREFIX=prefix
44 /FIXED_OUTFILES
45 /NAME_PREFIX=prefix
46 /NOLINES
47 /NOPARSER
48 /OUTPUT=outfilefile
49 /RAW
50 /TOKEN_TABLE
51 /VERBOSE
52 /VERSION
53 /YACC
54 .end literal
55 .skip
56 .indent -1
57 2 /DEBUG
58 .skip
59 In the parser file,
60 define the macro YYDEBUG to 1 if it is not already defined,
61 so that the debugging facilities are compiled.
62 .skip
63 .indent -1
64 2 /DEFINES
65 .skip
66 Write an extra output file containing macro definitions for the token
67 type names defined in the grammar and the semantic value type
68 YYSTYPE, as well as a extern variable declarations.
69 .skip
70 If the parser output file is named "name.c" then this file
71 is named "name.h".
72 .skip
73 This output file is essential if you wish to put the definition of
74 yylex in a separate source file, because yylex needs to
75 be able to refer to token type codes and the variable
76 yylval.
77 .skip
78 .indent -1
79 2 /FILE_PREFIX
80 .skip
81 .literal
82 /FILIE_PREFIX=prefix
83 .end literal
84 .skip
85 Specify a prefix to use for all Bison output file names. The names are
86 chosen as if the input file were named prefix.c
87
88 .skip
89 .indent -1
90 2 /FIXED_OUTFILES
91 .skip
92 Equivalent to /OUTPUT=y_tab.c; the parser output file is called
93 y_tab.c, and the other outputs are called y.output and
94 y_tab.h. The purpose of this switch is to imitate Yacc's output
95 file name conventions. The /YACC qualifier is functionally equivalent
96 to /FIXED_OUTFILES. The following command definition will
97 work as a substitute for Yacc:
98
99 .literal
100 $YACC:==BISON/FIXED_OUTFILES
101 .end literal
102 .skip
103 .indent -1
104 2 /NAME_PREFIX
105 .skip
106 .literal
107 /NAME_PREFIX=prefix
108 .end literal
109 .skip
110 Rename the external symbols used in the parser so that they start with
111 "prefix" instead of "yy". The precise list of symbols renamed
112 is yyparse, yylex, yyerror, yylval, yychar and yydebug.
113
114 For example, if you use /NAME_PREFIX="c", the names become cparse,
115 clex, and so on.
116
117 .skip
118 .indent -1
119 2 /NOLINES
120 .skip
121 Don't put any "#line" preprocessor commands in the parser file.
122 Ordinarily Bison puts them in the parser file so that the C compiler
123 and debuggers will associate errors with your source file, the
124 grammar file. This option causes them to associate errors with the
125 parser file, treating it an independent source file in its own right.
126 .skip
127 .indent -1
128 2 /NOPARSER
129 .skip
130 Do not generate the parser code into the output; generate only
131 declarations. The generated name_tab.c file will have only
132 constant declarations. In addition, a name.act file is
133 generated containing a switch statement body containing all the
134 translated actions.
135 .skip
136 .indent -1
137 2 /OUTPUT
138 .skip
139 .literal
140 /OUTPUT=outfile
141 .end literal
142 .skip
143 Specify the name "outfile" for the parser file.
144 .skip
145 .indent -1
146 2 /RAW
147 .skip
148 When this switch is specified, the .tab.h file defines the tokens to
149 have the bison token numbers rather than the yacc compatible numbers.
150 To employ this switch you would have to have your own parser.
151 .skip
152 .indent -1
153 2 /TOKEN_TABLE
154 .skip
155 This switch causes the name_tab.c output to include a list of
156 token names in order by their token numbers; this is defined in the array
157 yytname. Also generated are #defines for YYNTOKENS, YYNNTS, YYNRULES,
158 and YYNSTATES.
159
160 .skip
161 .indent -1
162 2 /VERBOSE
163 .skip
164 Write an extra output file containing verbose descriptions of the
165 parser states and what is done for each type of look-ahead token in
166 that state.
167 .skip
168 This file also describes all the conflicts, both those resolved by
169 operator precedence and the unresolved ones.
170 .skip
171 The file's name is made by removing _tab.c or .c from
172 the parser output file name, and adding .output instead.
173 .skip
174 Therefore, if the input file is foo.y, then the parser file is
175 called foo_tab.c by default. As a consequence, the verbose
176 output file is called foo.output.
177 .skip
178 .indent -1
179 2 /VERSION
180 .skip
181 Print the version number of Bison.
182
183 .skip
184 .indent -1
185 2 /YACC
186 .skip
187 See /FIXED_OUTFILES.
188 .skip
189 .indent -1
190
191
192