]> git.saurik.com Git - bison.git/blob - doc/bison.info-5
a917e95cb84129cec175674b58f9abf0caf2fb13
[bison.git] / doc / bison.info-5
1 Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0 à
2 partir bison.texinfo.
3
4 START-INFO-DIR-ENTRY
5 * bison: (bison). GNU Project parser generator (yacc replacement).
6 END-INFO-DIR-ENTRY
7
8 This file documents the Bison parser generator.
9
10 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999,
11 2000 Free Software Foundation, Inc.
12
13 Permission is granted to make and distribute verbatim copies of this
14 manual provided the copyright notice and this permission notice are
15 preserved on all copies.
16
17 Permission is granted to copy and distribute modified versions of
18 this manual under the conditions for verbatim copying, provided also
19 that the sections entitled "GNU General Public License" and "Conditions
20 for Using Bison" are included exactly as in the original, and provided
21 that the entire resulting derived work is distributed under the terms
22 of a permission notice identical to this one.
23
24 Permission is granted to copy and distribute translations of this
25 manual into another language, under the above conditions for modified
26 versions, except that the sections entitled "GNU General Public
27 License", "Conditions for Using Bison" and this permission notice may be
28 included in translations approved by the Free Software Foundation
29 instead of in the original English.
30
31 \1f
32 File: bison.info, Node: Glossary, Next: Index, Prev: Table of Symbols, Up: Top
33
34 Glossary
35 ********
36
37 Backus-Naur Form (BNF)
38 Formal method of specifying context-free grammars. BNF was first
39 used in the `ALGOL-60' report, 1963. *Note Languages and
40 Context-Free Grammars: Language and Grammar.
41
42 Context-free grammars
43 Grammars specified as rules that can be applied regardless of
44 context. Thus, if there is a rule which says that an integer can
45 be used as an expression, integers are allowed _anywhere_ an
46 expression is permitted. *Note Languages and Context-Free
47 Grammars: Language and Grammar.
48
49 Dynamic allocation
50 Allocation of memory that occurs during execution, rather than at
51 compile time or on entry to a function.
52
53 Empty string
54 Analogous to the empty set in set theory, the empty string is a
55 character string of length zero.
56
57 Finite-state stack machine
58 A "machine" that has discrete states in which it is said to exist
59 at each instant in time. As input to the machine is processed, the
60 machine moves from state to state as specified by the logic of the
61 machine. In the case of the parser, the input is the language
62 being parsed, and the states correspond to various stages in the
63 grammar rules. *Note The Bison Parser Algorithm: Algorithm.
64
65 Grouping
66 A language construct that is (in general) grammatically divisible;
67 for example, `expression' or `declaration' in C. *Note Languages
68 and Context-Free Grammars: Language and Grammar.
69
70 Infix operator
71 An arithmetic operator that is placed between the operands on
72 which it performs some operation.
73
74 Input stream
75 A continuous flow of data between devices or programs.
76
77 Language construct
78 One of the typical usage schemas of the language. For example,
79 one of the constructs of the C language is the `if' statement.
80 *Note Languages and Context-Free Grammars: Language and Grammar.
81
82 Left associativity
83 Operators having left associativity are analyzed from left to
84 right: `a+b+c' first computes `a+b' and then combines with `c'.
85 *Note Operator Precedence: Precedence.
86
87 Left recursion
88 A rule whose result symbol is also its first component symbol; for
89 example, `expseq1 : expseq1 ',' exp;'. *Note Recursive Rules:
90 Recursion.
91
92 Left-to-right parsing
93 Parsing a sentence of a language by analyzing it token by token
94 from left to right. *Note The Bison Parser Algorithm: Algorithm.
95
96 Lexical analyzer (scanner)
97 A function that reads an input stream and returns tokens one by
98 one. *Note The Lexical Analyzer Function `yylex': Lexical.
99
100 Lexical tie-in
101 A flag, set by actions in the grammar rules, which alters the way
102 tokens are parsed. *Note Lexical Tie-ins::.
103
104 Literal string token
105 A token which consists of two or more fixed characters. *Note
106 Symbols::.
107
108 Look-ahead token
109 A token already read but not yet shifted. *Note Look-Ahead
110 Tokens: Look-Ahead.
111
112 LALR(1)
113 The class of context-free grammars that Bison (like most other
114 parser generators) can handle; a subset of LR(1). *Note
115 Mysterious Reduce/Reduce Conflicts: Mystery Conflicts.
116
117 LR(1)
118 The class of context-free grammars in which at most one token of
119 look-ahead is needed to disambiguate the parsing of any piece of
120 input.
121
122 Nonterminal symbol
123 A grammar symbol standing for a grammatical construct that can be
124 expressed through rules in terms of smaller constructs; in other
125 words, a construct that is not a token. *Note Symbols::.
126
127 Parse error
128 An error encountered during parsing of an input stream due to
129 invalid syntax. *Note Error Recovery::.
130
131 Parser
132 A function that recognizes valid sentences of a language by
133 analyzing the syntax structure of a set of tokens passed to it
134 from a lexical analyzer.
135
136 Postfix operator
137 An arithmetic operator that is placed after the operands upon
138 which it performs some operation.
139
140 Reduction
141 Replacing a string of nonterminals and/or terminals with a single
142 nonterminal, according to a grammar rule. *Note The Bison Parser
143 Algorithm: Algorithm.
144
145 Reentrant
146 A reentrant subprogram is a subprogram which can be in invoked any
147 number of times in parallel, without interference between the
148 various invocations. *Note A Pure (Reentrant) Parser: Pure Decl.
149
150 Reverse polish notation
151 A language in which all operators are postfix operators.
152
153 Right recursion
154 A rule whose result symbol is also its last component symbol; for
155 example, `expseq1: exp ',' expseq1;'. *Note Recursive Rules:
156 Recursion.
157
158 Semantics
159 In computer languages, the semantics are specified by the actions
160 taken for each instance of the language, i.e., the meaning of each
161 statement. *Note Defining Language Semantics: Semantics.
162
163 Shift
164 A parser is said to shift when it makes the choice of analyzing
165 further input from the stream rather than reducing immediately some
166 already-recognized rule. *Note The Bison Parser Algorithm:
167 Algorithm.
168
169 Single-character literal
170 A single character that is recognized and interpreted as is.
171 *Note From Formal Rules to Bison Input: Grammar in Bison.
172
173 Start symbol
174 The nonterminal symbol that stands for a complete valid utterance
175 in the language being parsed. The start symbol is usually listed
176 as the first nonterminal symbol in a language specification.
177 *Note The Start-Symbol: Start Decl.
178
179 Symbol table
180 A data structure where symbol names and associated data are stored
181 during parsing to allow for recognition and use of existing
182 information in repeated uses of a symbol. *Note Multi-function
183 Calc::.
184
185 Token
186 A basic, grammatically indivisible unit of a language. The symbol
187 that describes a token in the grammar is a terminal symbol. The
188 input of the Bison parser is a stream of tokens which comes from
189 the lexical analyzer. *Note Symbols::.
190
191 Terminal symbol
192 A grammar symbol that has no rules in the grammar and therefore is
193 grammatically indivisible. The piece of text it represents is a
194 token. *Note Languages and Context-Free Grammars: Language and
195 Grammar.
196
197 \1f
198 File: bison.info, Node: Index, Prev: Glossary, Up: Top
199
200 Index
201 *****
202
203 * Menu:
204
205 * $$: Actions.
206 * $N: Actions.
207 * %expect: Expect Decl.
208 * %left: Using Precedence.
209 * %nonassoc: Using Precedence.
210 * %prec: Contextual Precedence.
211 * %pure_parser: Pure Decl.
212 * %right: Using Precedence.
213 * %start: Start Decl.
214 * %token: Token Decl.
215 * %type: Type Decl.
216 * %union: Union Decl.
217 * @N: Action Features.
218 * action: Actions.
219 * action data types: Action Types.
220 * action features summary: Action Features.
221 * actions in mid-rule: Mid-Rule Actions.
222 * actions, semantic: Semantic Actions.
223 * additional C code section: C Code.
224 * algorithm of parser: Algorithm.
225 * associativity: Why Precedence.
226 * Backus-Naur form: Language and Grammar.
227 * Bison declaration summary: Decl Summary.
228 * Bison declarations: Declarations.
229 * Bison declarations (introduction): Bison Declarations.
230 * Bison grammar: Grammar in Bison.
231 * Bison invocation: Invocation.
232 * Bison parser: Bison Parser.
233 * Bison parser algorithm: Algorithm.
234 * Bison symbols, table of: Table of Symbols.
235 * Bison utility: Bison Parser.
236 * BISON_HAIRY: Environment Variables.
237 * BISON_SIMPLE: Environment Variables.
238 * BNF: Language and Grammar.
239 * C code, section for additional: C Code.
240 * C declarations section: C Declarations.
241 * C-language interface: Interface.
242 * calc: Infix Calc.
243 * calculator, infix notation: Infix Calc.
244 * calculator, multi-function: Multi-function Calc.
245 * calculator, simple: RPN Calc.
246 * character token: Symbols.
247 * compiling the parser: Rpcalc Compile.
248 * conflicts: Shift/Reduce.
249 * conflicts, reduce/reduce: Reduce/Reduce.
250 * conflicts, suppressing warnings of: Expect Decl.
251 * context-dependent precedence: Contextual Precedence.
252 * context-free grammar: Language and Grammar.
253 * controlling function: Rpcalc Main.
254 * dangling else: Shift/Reduce.
255 * data types in actions: Action Types.
256 * data types of semantic values: Value Type.
257 * debugging: Debugging.
258 * declaration summary: Decl Summary.
259 * declarations, Bison: Declarations.
260 * declarations, Bison (introduction): Bison Declarations.
261 * declarations, C: C Declarations.
262 * declaring literal string tokens: Token Decl.
263 * declaring operator precedence: Precedence Decl.
264 * declaring the start symbol: Start Decl.
265 * declaring token type names: Token Decl.
266 * declaring value types: Union Decl.
267 * declaring value types, nonterminals: Type Decl.
268 * default action: Actions.
269 * default data type: Value Type.
270 * default stack limit: Stack Overflow.
271 * default start symbol: Start Decl.
272 * defining language semantics: Semantics.
273 * else, dangling: Shift/Reduce.
274 * environment variables: Environment Variables.
275 * error: Error Recovery.
276 * error recovery: Error Recovery.
277 * error recovery, simple: Simple Error Recovery.
278 * error reporting function: Error Reporting.
279 * error reporting routine: Rpcalc Error.
280 * examples, simple: Examples.
281 * exercises: Exercises.
282 * file format: Grammar Layout.
283 * finite-state machine: Parser States.
284 * formal grammar: Grammar in Bison.
285 * format of grammar file: Grammar Layout.
286 * glossary: Glossary.
287 * grammar file: Grammar Layout.
288 * grammar rule syntax: Rules.
289 * grammar rules section: Grammar Rules.
290 * grammar, Bison: Grammar in Bison.
291 * grammar, context-free: Language and Grammar.
292 * grouping, syntactic: Language and Grammar.
293 * infix notation calculator: Infix Calc.
294 * interface: Interface.
295 * introduction: Introduction.
296 * invoking Bison: Invocation.
297 * invoking Bison under VMS: VMS Invocation.
298 * LALR(1): Mystery Conflicts.
299 * language semantics, defining: Semantics.
300 * layout of Bison grammar: Grammar Layout.
301 * left recursion: Recursion.
302 * lexical analyzer: Lexical.
303 * lexical analyzer, purpose: Bison Parser.
304 * lexical analyzer, writing: Rpcalc Lexer.
305 * lexical tie-in: Lexical Tie-ins.
306 * literal string token: Symbols.
307 * literal token: Symbols.
308 * look-ahead token: Look-Ahead.
309 * LR(1): Mystery Conflicts.
310 * main function in simple example: Rpcalc Main.
311 * mfcalc: Multi-function Calc.
312 * mid-rule actions: Mid-Rule Actions.
313 * multi-function calculator: Multi-function Calc.
314 * multicharacter literal: Symbols.
315 * mutual recursion: Recursion.
316 * nonterminal symbol: Symbols.
317 * operator precedence: Precedence.
318 * operator precedence, declaring: Precedence Decl.
319 * options for invoking Bison: Invocation.
320 * overflow of parser stack: Stack Overflow.
321 * parse error: Error Reporting.
322 * parser: Bison Parser.
323 * parser stack: Algorithm.
324 * parser stack overflow: Stack Overflow.
325 * parser state: Parser States.
326 * polish notation calculator: RPN Calc.
327 * precedence declarations: Precedence Decl.
328 * precedence of operators: Precedence.
329 * precedence, context-dependent: Contextual Precedence.
330 * precedence, unary operator: Contextual Precedence.
331 * preventing warnings about conflicts: Expect Decl.
332 * pure parser: Pure Decl.
333 * recovery from errors: Error Recovery.
334 * recursive rule: Recursion.
335 * reduce/reduce conflict: Reduce/Reduce.
336 * reduction: Algorithm.
337 * reentrant parser: Pure Decl.
338 * reverse polish notation: RPN Calc.
339 * right recursion: Recursion.
340 * rpcalc: RPN Calc.
341 * rule syntax: Rules.
342 * rules section for grammar: Grammar Rules.
343 * running Bison (introduction): Rpcalc Gen.
344 * semantic actions: Semantic Actions.
345 * semantic value: Semantic Values.
346 * semantic value type: Value Type.
347 * shift/reduce conflicts: Shift/Reduce.
348 * shifting: Algorithm.
349 * simple examples: Examples.
350 * single-character literal: Symbols.
351 * stack overflow: Stack Overflow.
352 * stack, parser: Algorithm.
353 * stages in using Bison: Stages.
354 * start symbol: Language and Grammar.
355 * start symbol, declaring: Start Decl.
356 * state (of parser): Parser States.
357 * string token: Symbols.
358 * summary, action features: Action Features.
359 * summary, Bison declaration: Decl Summary.
360 * suppressing conflict warnings: Expect Decl.
361 * symbol: Symbols.
362 * symbol table example: Mfcalc Symtab.
363 * symbols (abstract): Language and Grammar.
364 * symbols in Bison, table of: Table of Symbols.
365 * syntactic grouping: Language and Grammar.
366 * syntax error: Error Reporting.
367 * syntax of grammar rules: Rules.
368 * terminal symbol: Symbols.
369 * token: Language and Grammar.
370 * token type: Symbols.
371 * token type names, declaring: Token Decl.
372 * tracing the parser: Debugging.
373 * unary operator precedence: Contextual Precedence.
374 * using Bison: Stages.
375 * value type, semantic: Value Type.
376 * value types, declaring: Union Decl.
377 * value types, nonterminals, declaring: Type Decl.
378 * value, semantic: Semantic Values.
379 * VMS: VMS Invocation.
380 * warnings, preventing: Expect Decl.
381 * writing a lexical analyzer: Rpcalc Lexer.
382 * YYABORT: Parser Function.
383 * YYACCEPT: Parser Function.
384 * YYBACKUP: Action Features.
385 * yychar: Look-Ahead.
386 * yyclearin: Error Recovery.
387 * yydebug: Debugging.
388 * YYDEBUG: Debugging.
389 * YYEMPTY: Action Features.
390 * yyerrok: Error Recovery.
391 * YYERROR: Action Features.
392 * yyerror: Error Reporting.
393 * YYERROR_VERBOSE: Error Reporting.
394 * YYINITDEPTH: Stack Overflow.
395 * yylex: Lexical.
396 * YYLEX_PARAM: Pure Calling.
397 * yylloc: Token Positions.
398 * YYLTYPE: Token Positions.
399 * yylval: Token Values.
400 * YYMAXDEPTH: Stack Overflow.
401 * yynerrs: Error Reporting.
402 * yyparse: Parser Function.
403 * YYPARSE_PARAM: Pure Calling.
404 * YYPRINT: Debugging.
405 * YYRECOVERING: Error Recovery.
406 * |: Rules.
407
408