1 Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0b
2 à partir bison.texinfo.
5 * bison: (bison). GNU Project parser generator (yacc replacement).
8 This file documents the Bison parser generator.
10 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999,
11 2000 Free Software Foundation, Inc.
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.
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.
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.
32 File: bison.info, Node: Glossary, Next: Index, Prev: Table of Symbols, Up: Top
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.
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.
50 Allocation of memory that occurs during execution, rather than at
51 compile time or on entry to a function.
54 Analogous to the empty set in set theory, the empty string is a
55 character string of length zero.
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.
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.
71 An arithmetic operator that is placed between the operands on
72 which it performs some operation.
75 A continuous flow of data between devices or programs.
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.
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.
88 A rule whose result symbol is also its first component symbol; for
89 example, `expseq1 : expseq1 ',' exp;'. *Note Recursive Rules:
93 Parsing a sentence of a language by analyzing it token by token
94 from left to right. *Note The Bison Parser Algorithm: Algorithm.
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.
101 A flag, set by actions in the grammar rules, which alters the way
102 tokens are parsed. *Note Lexical Tie-ins::.
105 A token which consists of two or more fixed characters. *Note
109 A token already read but not yet shifted. *Note Look-Ahead
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.
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
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::.
128 An error encountered during parsing of an input stream due to
129 invalid syntax. *Note Error Recovery::.
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.
137 An arithmetic operator that is placed after the operands upon
138 which it performs some operation.
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.
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.
150 Reverse polish notation
151 A language in which all operators are postfix operators.
154 A rule whose result symbol is also its last component symbol; for
155 example, `expseq1: exp ',' expseq1;'. *Note Recursive Rules:
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.
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:
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.
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.
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
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::.
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
198 File: bison.info, Node: Index, Prev: Glossary, Up: Top
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.
216 * %union: Union Decl.
217 * @$ <1>: Action Features.
218 * @$: Actions and Locations.
219 * @N <1>: Action Features.
220 * @N: Actions and Locations.
222 * action data types: Action Types.
223 * action features summary: Action Features.
224 * actions in mid-rule: Mid-Rule Actions.
225 * actions, location: Actions and Locations.
226 * actions, semantic: Semantic Actions.
227 * additional C code section: C Code.
228 * algorithm of parser: Algorithm.
229 * associativity: Why Precedence.
230 * Backus-Naur form: Language and Grammar.
231 * Bison declaration summary: Decl Summary.
232 * Bison declarations: Declarations.
233 * Bison declarations (introduction): Bison Declarations.
234 * Bison grammar: Grammar in Bison.
235 * Bison invocation: Invocation.
236 * Bison parser: Bison Parser.
237 * Bison parser algorithm: Algorithm.
238 * Bison symbols, table of: Table of Symbols.
239 * Bison utility: Bison Parser.
240 * BISON_HAIRY: Environment Variables.
241 * BISON_SIMPLE: Environment Variables.
242 * BNF: Language and Grammar.
243 * C code, section for additional: C Code.
244 * C declarations section: C Declarations.
245 * C-language interface: Interface.
247 * calculator, infix notation: Infix Calc.
248 * calculator, multi-function: Multi-function Calc.
249 * calculator, simple: RPN Calc.
250 * character token: Symbols.
251 * compiling the parser: Rpcalc Compile.
252 * conflicts: Shift/Reduce.
253 * conflicts, reduce/reduce: Reduce/Reduce.
254 * conflicts, suppressing warnings of: Expect Decl.
255 * context-dependent precedence: Contextual Precedence.
256 * context-free grammar: Language and Grammar.
257 * controlling function: Rpcalc Main.
258 * dangling else: Shift/Reduce.
259 * data type of locations: Location Type.
260 * data types in actions: Action Types.
261 * data types of semantic values: Value Type.
262 * debugging: Debugging.
263 * declaration summary: Decl Summary.
264 * declarations, Bison: Declarations.
265 * declarations, Bison (introduction): Bison Declarations.
266 * declarations, C: C Declarations.
267 * declaring literal string tokens: Token Decl.
268 * declaring operator precedence: Precedence Decl.
269 * declaring the start symbol: Start Decl.
270 * declaring token type names: Token Decl.
271 * declaring value types: Union Decl.
272 * declaring value types, nonterminals: Type Decl.
273 * default action: Actions.
274 * default data type: Value Type.
275 * default location type: Location Type.
276 * default stack limit: Stack Overflow.
277 * default start symbol: Start Decl.
278 * defining language semantics: Semantics.
279 * else, dangling: Shift/Reduce.
280 * environment variables: Environment Variables.
281 * error: Error Recovery.
282 * error recovery: Error Recovery.
283 * error recovery, simple: Simple Error Recovery.
284 * error reporting function: Error Reporting.
285 * error reporting routine: Rpcalc Error.
286 * examples, simple: Examples.
287 * exercises: Exercises.
288 * file format: Grammar Layout.
289 * finite-state machine: Parser States.
290 * formal grammar: Grammar in Bison.
291 * format of grammar file: Grammar Layout.
292 * glossary: Glossary.
293 * grammar file: Grammar Layout.
294 * grammar rule syntax: Rules.
295 * grammar rules section: Grammar Rules.
296 * grammar, Bison: Grammar in Bison.
297 * grammar, context-free: Language and Grammar.
298 * grouping, syntactic: Language and Grammar.
299 * infix notation calculator: Infix Calc.
300 * interface: Interface.
301 * introduction: Introduction.
302 * invoking Bison: Invocation.
303 * invoking Bison under VMS: VMS Invocation.
304 * LALR(1): Mystery Conflicts.
305 * language semantics, defining: Semantics.
306 * layout of Bison grammar: Grammar Layout.
307 * left recursion: Recursion.
308 * lexical analyzer: Lexical.
309 * lexical analyzer, purpose: Bison Parser.
310 * lexical analyzer, writing: Rpcalc Lexer.
311 * lexical tie-in: Lexical Tie-ins.
312 * literal string token: Symbols.
313 * literal token: Symbols.
314 * location <1>: Locations.
315 * location: Locations Overview.
316 * location actions: Actions and Locations.
317 * look-ahead token: Look-Ahead.
318 * LR(1): Mystery Conflicts.
319 * main function in simple example: Rpcalc Main.
320 * mfcalc: Multi-function Calc.
321 * mid-rule actions: Mid-Rule Actions.
322 * multi-function calculator: Multi-function Calc.
323 * multicharacter literal: Symbols.
324 * mutual recursion: Recursion.
325 * nonterminal symbol: Symbols.
326 * operator precedence: Precedence.
327 * operator precedence, declaring: Precedence Decl.
328 * options for invoking Bison: Invocation.
329 * overflow of parser stack: Stack Overflow.
330 * parse error: Error Reporting.
331 * parser: Bison Parser.
332 * parser stack: Algorithm.
333 * parser stack overflow: Stack Overflow.
334 * parser state: Parser States.
335 * polish notation calculator: RPN Calc.
336 * position, textual <1>: Locations.
337 * position, textual: Locations Overview.
338 * precedence declarations: Precedence Decl.
339 * precedence of operators: Precedence.
340 * precedence, context-dependent: Contextual Precedence.
341 * precedence, unary operator: Contextual Precedence.
342 * preventing warnings about conflicts: Expect Decl.
343 * pure parser: Pure Decl.
344 * recovery from errors: Error Recovery.
345 * recursive rule: Recursion.
346 * reduce/reduce conflict: Reduce/Reduce.
347 * reduction: Algorithm.
348 * reentrant parser: Pure Decl.
349 * reverse polish notation: RPN Calc.
350 * right recursion: Recursion.
352 * rule syntax: Rules.
353 * rules section for grammar: Grammar Rules.
354 * running Bison (introduction): Rpcalc Gen.
355 * semantic actions: Semantic Actions.
356 * semantic value: Semantic Values.
357 * semantic value type: Value Type.
358 * shift/reduce conflicts: Shift/Reduce.
359 * shifting: Algorithm.
360 * simple examples: Examples.
361 * single-character literal: Symbols.
362 * stack overflow: Stack Overflow.
363 * stack, parser: Algorithm.
364 * stages in using Bison: Stages.
365 * start symbol: Language and Grammar.
366 * start symbol, declaring: Start Decl.
367 * state (of parser): Parser States.
368 * string token: Symbols.
369 * summary, action features: Action Features.
370 * summary, Bison declaration: Decl Summary.
371 * suppressing conflict warnings: Expect Decl.
373 * symbol table example: Mfcalc Symtab.
374 * symbols (abstract): Language and Grammar.
375 * symbols in Bison, table of: Table of Symbols.
376 * syntactic grouping: Language and Grammar.
377 * syntax error: Error Reporting.
378 * syntax of grammar rules: Rules.
379 * terminal symbol: Symbols.
380 * textual position <1>: Locations.
381 * textual position: Locations Overview.
382 * token: Language and Grammar.
383 * token type: Symbols.
384 * token type names, declaring: Token Decl.
385 * tracing the parser: Debugging.
386 * unary operator precedence: Contextual Precedence.
387 * using Bison: Stages.
388 * value type, semantic: Value Type.
389 * value types, declaring: Union Decl.
390 * value types, nonterminals, declaring: Type Decl.
391 * value, semantic: Semantic Values.
392 * VMS: VMS Invocation.
393 * warnings, preventing: Expect Decl.
394 * writing a lexical analyzer: Rpcalc Lexer.
395 * YYABORT: Parser Function.
396 * YYACCEPT: Parser Function.
397 * YYBACKUP: Action Features.
398 * yychar: Look-Ahead.
399 * yyclearin: Error Recovery.
400 * yydebug: Debugging.
401 * YYDEBUG: Debugging.
402 * YYEMPTY: Action Features.
403 * yyerrok: Error Recovery.
404 * YYERROR: Action Features.
405 * yyerror: Error Reporting.
406 * YYERROR_VERBOSE: Error Reporting.
407 * YYINITDEPTH: Stack Overflow.
409 * YYLEX_PARAM: Pure Calling.
410 * yylloc: Token Positions.
411 * YYLLOC_DEFAULT: Location Default Action.
412 * YYLTYPE: Token Positions.
413 * yylval: Token Values.
414 * YYMAXDEPTH: Stack Overflow.
415 * yynerrs: Error Reporting.
416 * yyparse: Parser Function.
417 * YYPARSE_PARAM: Pure Calling.
418 * YYPRINT: Debugging.
419 * YYRECOVERING: Error Recovery.