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