Imported Upstream version 2.6.2
[platform/upstream/bison.git] / doc / bison.info-2
1 This is bison.info, produced by makeinfo version 4.13 from
2 /Users/akim/src/gnu/bison-2.5/doc/bison.texi.
3
4 This manual (27 July 2012) is for GNU Bison (version 2.6.1-dirty), the
5 GNU parser generator.
6
7    Copyright (C) 1988-1993, 1995, 1998-2012 Free Software Foundation,
8 Inc.
9
10      Permission is granted to copy, distribute and/or modify this
11      document under the terms of the GNU Free Documentation License,
12      Version 1.3 or any later version published by the Free Software
13      Foundation; with no Invariant Sections, with the Front-Cover texts
14      being "A GNU Manual," and with the Back-Cover Texts as in (a)
15      below.  A copy of the license is included in the section entitled
16      "GNU Free Documentation License."
17
18      (a) The FSF's Back-Cover Text is: "You have the freedom to copy and
19      modify this GNU manual.  Buying copies from the FSF supports it in
20      developing GNU and promoting software freedom."
21
22 INFO-DIR-SECTION Software development
23 START-INFO-DIR-ENTRY
24 * bison: (bison).       GNU parser generator (Yacc replacement).
25 END-INFO-DIR-ENTRY
26
27 \1f
28 File: bison.info,  Node: Memory Management,  Prev: Generalized LR Parsing,  Up: Algorithm
29
30 5.10 Memory Management, and How to Avoid Memory Exhaustion
31 ==========================================================
32
33 The Bison parser stack can run out of memory if too many tokens are
34 shifted and not reduced.  When this happens, the parser function
35 `yyparse' calls `yyerror' and then returns 2.
36
37    Because Bison parsers have growing stacks, hitting the upper limit
38 usually results from using a right recursion instead of a left
39 recursion, see *note Recursive Rules: Recursion.
40
41    By defining the macro `YYMAXDEPTH', you can control how deep the
42 parser stack can become before memory is exhausted.  Define the macro
43 with a value that is an integer.  This value is the maximum number of
44 tokens that can be shifted (and not reduced) before overflow.
45
46    The stack space allowed is not necessarily allocated.  If you
47 specify a large value for `YYMAXDEPTH', the parser normally allocates a
48 small stack at first, and then makes it bigger by stages as needed.
49 This increasing allocation happens automatically and silently.
50 Therefore, you do not need to make `YYMAXDEPTH' painfully small merely
51 to save space for ordinary inputs that do not need much stack.
52
53    However, do not allow `YYMAXDEPTH' to be a value so large that
54 arithmetic overflow could occur when calculating the size of the stack
55 space.  Also, do not allow `YYMAXDEPTH' to be less than `YYINITDEPTH'.
56
57    The default value of `YYMAXDEPTH', if you do not define it, is 10000.
58
59    You can control how much stack is allocated initially by defining the
60 macro `YYINITDEPTH' to a positive integer.  For the deterministic
61 parser in C, this value must be a compile-time constant unless you are
62 assuming C99 or some other target language or compiler that allows
63 variable-length arrays.  The default is 200.
64
65    Do not allow `YYINITDEPTH' to be greater than `YYMAXDEPTH'.
66
67    Because of semantic differences between C and C++, the deterministic
68 parsers in C produced by Bison cannot grow when compiled by C++
69 compilers.  In this precise case (compiling a C parser as C++) you are
70 suggested to grow `YYINITDEPTH'.  The Bison maintainers hope to fix
71 this deficiency in a future release.
72
73 \1f
74 File: bison.info,  Node: Error Recovery,  Next: Context Dependency,  Prev: Algorithm,  Up: Top
75
76 6 Error Recovery
77 ****************
78
79 It is not usually acceptable to have a program terminate on a syntax
80 error.  For example, a compiler should recover sufficiently to parse the
81 rest of the input file and check it for errors; a calculator should
82 accept another expression.
83
84    In a simple interactive command parser where each input is one line,
85 it may be sufficient to allow `yyparse' to return 1 on error and have
86 the caller ignore the rest of the input line when that happens (and
87 then call `yyparse' again).  But this is inadequate for a compiler,
88 because it forgets all the syntactic context leading up to the error.
89 A syntax error deep within a function in the compiler input should not
90 cause the compiler to treat the following line like the beginning of a
91 source file.
92
93    You can define how to recover from a syntax error by writing rules to
94 recognize the special token `error'.  This is a terminal symbol that is
95 always defined (you need not declare it) and reserved for error
96 handling.  The Bison parser generates an `error' token whenever a
97 syntax error happens; if you have provided a rule to recognize this
98 token in the current context, the parse can continue.
99
100    For example:
101
102      stmts:
103        /* empty string */
104      | stmts '\n'
105      | stmts exp '\n'
106      | stmts error '\n'
107
108    The fourth rule in this example says that an error followed by a
109 newline makes a valid addition to any `stmts'.
110
111    What happens if a syntax error occurs in the middle of an `exp'?  The
112 error recovery rule, interpreted strictly, applies to the precise
113 sequence of a `stmts', an `error' and a newline.  If an error occurs in
114 the middle of an `exp', there will probably be some additional tokens
115 and subexpressions on the stack after the last `stmts', and there will
116 be tokens to read before the next newline.  So the rule is not
117 applicable in the ordinary way.
118
119    But Bison can force the situation to fit the rule, by discarding
120 part of the semantic context and part of the input.  First it discards
121 states and objects from the stack until it gets back to a state in
122 which the `error' token is acceptable.  (This means that the
123 subexpressions already parsed are discarded, back to the last complete
124 `stmts'.)  At this point the `error' token can be shifted.  Then, if
125 the old lookahead token is not acceptable to be shifted next, the
126 parser reads tokens and discards them until it finds a token which is
127 acceptable.  In this example, Bison reads and discards input until the
128 next newline so that the fourth rule can apply.  Note that discarded
129 symbols are possible sources of memory leaks, see *note Freeing
130 Discarded Symbols: Destructor Decl, for a means to reclaim this memory.
131
132    The choice of error rules in the grammar is a choice of strategies
133 for error recovery.  A simple and useful strategy is simply to skip the
134 rest of the current input line or current statement if an error is
135 detected:
136
137      stmt: error ';'  /* On error, skip until ';' is read.  */
138
139    It is also useful to recover to the matching close-delimiter of an
140 opening-delimiter that has already been parsed.  Otherwise the
141 close-delimiter will probably appear to be unmatched, and generate
142 another, spurious error message:
143
144      primary:
145        '(' expr ')'
146      | '(' error ')'
147      ...
148      ;
149
150    Error recovery strategies are necessarily guesses.  When they guess
151 wrong, one syntax error often leads to another.  In the above example,
152 the error recovery rule guesses that an error is due to bad input
153 within one `stmt'.  Suppose that instead a spurious semicolon is
154 inserted in the middle of a valid `stmt'.  After the error recovery
155 rule recovers from the first error, another syntax error will be found
156 straightaway, since the text following the spurious semicolon is also
157 an invalid `stmt'.
158
159    To prevent an outpouring of error messages, the parser will output
160 no error message for another syntax error that happens shortly after
161 the first; only after three consecutive input tokens have been
162 successfully shifted will error messages resume.
163
164    Note that rules which accept the `error' token may have actions, just
165 as any other rules can.
166
167    You can make error messages resume immediately by using the macro
168 `yyerrok' in an action.  If you do this in the error rule's action, no
169 error messages will be suppressed.  This macro requires no arguments;
170 `yyerrok;' is a valid C statement.
171
172    The previous lookahead token is reanalyzed immediately after an
173 error.  If this is unacceptable, then the macro `yyclearin' may be used
174 to clear this token.  Write the statement `yyclearin;' in the error
175 rule's action.  *Note Special Features for Use in Actions: Action
176 Features.
177
178    For example, suppose that on a syntax error, an error handling
179 routine is called that advances the input stream to some point where
180 parsing should once again commence.  The next symbol returned by the
181 lexical scanner is probably correct.  The previous lookahead token
182 ought to be discarded with `yyclearin;'.
183
184    The expression `YYRECOVERING ()' yields 1 when the parser is
185 recovering from a syntax error, and 0 otherwise.  Syntax error
186 diagnostics are suppressed while recovering from a syntax error.
187
188 \1f
189 File: bison.info,  Node: Context Dependency,  Next: Debugging,  Prev: Error Recovery,  Up: Top
190
191 7 Handling Context Dependencies
192 *******************************
193
194 The Bison paradigm is to parse tokens first, then group them into larger
195 syntactic units.  In many languages, the meaning of a token is affected
196 by its context.  Although this violates the Bison paradigm, certain
197 techniques (known as "kludges") may enable you to write Bison parsers
198 for such languages.
199
200 * Menu:
201
202 * Semantic Tokens::   Token parsing can depend on the semantic context.
203 * Lexical Tie-ins::   Token parsing can depend on the syntactic context.
204 * Tie-in Recovery::   Lexical tie-ins have implications for how
205                         error recovery rules must be written.
206
207    (Actually, "kludge" means any technique that gets its job done but is
208 neither clean nor robust.)
209
210 \1f
211 File: bison.info,  Node: Semantic Tokens,  Next: Lexical Tie-ins,  Up: Context Dependency
212
213 7.1 Semantic Info in Token Types
214 ================================
215
216 The C language has a context dependency: the way an identifier is used
217 depends on what its current meaning is.  For example, consider this:
218
219      foo (x);
220
221    This looks like a function call statement, but if `foo' is a typedef
222 name, then this is actually a declaration of `x'.  How can a Bison
223 parser for C decide how to parse this input?
224
225    The method used in GNU C is to have two different token types,
226 `IDENTIFIER' and `TYPENAME'.  When `yylex' finds an identifier, it
227 looks up the current declaration of the identifier in order to decide
228 which token type to return: `TYPENAME' if the identifier is declared as
229 a typedef, `IDENTIFIER' otherwise.
230
231    The grammar rules can then express the context dependency by the
232 choice of token type to recognize.  `IDENTIFIER' is accepted as an
233 expression, but `TYPENAME' is not.  `TYPENAME' can start a declaration,
234 but `IDENTIFIER' cannot.  In contexts where the meaning of the
235 identifier is _not_ significant, such as in declarations that can
236 shadow a typedef name, either `TYPENAME' or `IDENTIFIER' is
237 accepted--there is one rule for each of the two token types.
238
239    This technique is simple to use if the decision of which kinds of
240 identifiers to allow is made at a place close to where the identifier is
241 parsed.  But in C this is not always so: C allows a declaration to
242 redeclare a typedef name provided an explicit type has been specified
243 earlier:
244
245      typedef int foo, bar;
246      int baz (void)
247      {
248        static bar (bar);      /* redeclare `bar' as static variable */
249        extern foo foo (foo);  /* redeclare `foo' as function */
250        return foo (bar);
251      }
252
253    Unfortunately, the name being declared is separated from the
254 declaration construct itself by a complicated syntactic structure--the
255 "declarator".
256
257    As a result, part of the Bison parser for C needs to be duplicated,
258 with all the nonterminal names changed: once for parsing a declaration
259 in which a typedef name can be redefined, and once for parsing a
260 declaration in which that can't be done.  Here is a part of the
261 duplication, with actions omitted for brevity:
262
263      initdcl:
264        declarator maybeasm '=' init
265      | declarator maybeasm
266      ;
267
268      notype_initdcl:
269        notype_declarator maybeasm '=' init
270      | notype_declarator maybeasm
271      ;
272
273 Here `initdcl' can redeclare a typedef name, but `notype_initdcl'
274 cannot.  The distinction between `declarator' and `notype_declarator'
275 is the same sort of thing.
276
277    There is some similarity between this technique and a lexical tie-in
278 (described next), in that information which alters the lexical analysis
279 is changed during parsing by other parts of the program.  The
280 difference is here the information is global, and is used for other
281 purposes in the program.  A true lexical tie-in has a special-purpose
282 flag controlled by the syntactic context.
283
284 \1f
285 File: bison.info,  Node: Lexical Tie-ins,  Next: Tie-in Recovery,  Prev: Semantic Tokens,  Up: Context Dependency
286
287 7.2 Lexical Tie-ins
288 ===================
289
290 One way to handle context-dependency is the "lexical tie-in": a flag
291 which is set by Bison actions, whose purpose is to alter the way tokens
292 are parsed.
293
294    For example, suppose we have a language vaguely like C, but with a
295 special construct `hex (HEX-EXPR)'.  After the keyword `hex' comes an
296 expression in parentheses in which all integers are hexadecimal.  In
297 particular, the token `a1b' must be treated as an integer rather than
298 as an identifier if it appears in that context.  Here is how you can do
299 it:
300
301      %{
302        int hexflag;
303        int yylex (void);
304        void yyerror (char const *);
305      %}
306      %%
307      ...
308      expr:
309        IDENTIFIER
310      | constant
311      | HEX '('        { hexflag = 1; }
312          expr ')'     { hexflag = 0; $$ = $4; }
313      | expr '+' expr  { $$ = make_sum ($1, $3); }
314      ...
315      ;
316
317      constant:
318        INTEGER
319      | STRING
320      ;
321
322 Here we assume that `yylex' looks at the value of `hexflag'; when it is
323 nonzero, all integers are parsed in hexadecimal, and tokens starting
324 with letters are parsed as integers if possible.
325
326    The declaration of `hexflag' shown in the prologue of the grammar
327 file is needed to make it accessible to the actions (*note The
328 Prologue: Prologue.).  You must also write the code in `yylex' to obey
329 the flag.
330
331 \1f
332 File: bison.info,  Node: Tie-in Recovery,  Prev: Lexical Tie-ins,  Up: Context Dependency
333
334 7.3 Lexical Tie-ins and Error Recovery
335 ======================================
336
337 Lexical tie-ins make strict demands on any error recovery rules you
338 have.  *Note Error Recovery::.
339
340    The reason for this is that the purpose of an error recovery rule is
341 to abort the parsing of one construct and resume in some larger
342 construct.  For example, in C-like languages, a typical error recovery
343 rule is to skip tokens until the next semicolon, and then start a new
344 statement, like this:
345
346      stmt:
347        expr ';'
348      | IF '(' expr ')' stmt { ... }
349      ...
350      | error ';'  { hexflag = 0; }
351      ;
352
353    If there is a syntax error in the middle of a `hex (EXPR)'
354 construct, this error rule will apply, and then the action for the
355 completed `hex (EXPR)' will never run.  So `hexflag' would remain set
356 for the entire rest of the input, or until the next `hex' keyword,
357 causing identifiers to be misinterpreted as integers.
358
359    To avoid this problem the error recovery rule itself clears
360 `hexflag'.
361
362    There may also be an error recovery rule that works within
363 expressions.  For example, there could be a rule which applies within
364 parentheses and skips to the close-parenthesis:
365
366      expr:
367        ...
368      | '(' expr ')'   { $$ = $2; }
369      | '(' error ')'
370      ...
371
372    If this rule acts within the `hex' construct, it is not going to
373 abort that construct (since it applies to an inner level of parentheses
374 within the construct).  Therefore, it should not clear the flag: the
375 rest of the `hex' construct should be parsed with the flag still in
376 effect.
377
378    What if there is an error recovery rule which might abort out of the
379 `hex' construct or might not, depending on circumstances?  There is no
380 way you can write the action to determine whether a `hex' construct is
381 being aborted or not.  So if you are using a lexical tie-in, you had
382 better make sure your error recovery rules are not of this kind.  Each
383 rule must be such that you can be sure that it always will, or always
384 won't, have to clear the flag.
385
386 \1f
387 File: bison.info,  Node: Debugging,  Next: Invocation,  Prev: Context Dependency,  Up: Top
388
389 8 Debugging Your Parser
390 ***********************
391
392 Developing a parser can be a challenge, especially if you don't
393 understand the algorithm (*note The Bison Parser Algorithm:
394 Algorithm.).  This chapter explains how to generate and read the
395 detailed description of the automaton, and how to enable and understand
396 the parser run-time traces.
397
398 * Menu:
399
400 * Understanding::     Understanding the structure of your parser.
401 * Tracing::           Tracing the execution of your parser.
402
403 \1f
404 File: bison.info,  Node: Understanding,  Next: Tracing,  Up: Debugging
405
406 8.1 Understanding Your Parser
407 =============================
408
409 As documented elsewhere (*note The Bison Parser Algorithm: Algorithm.)
410 Bison parsers are "shift/reduce automata".  In some cases (much more
411 frequent than one would hope), looking at this automaton is required to
412 tune or simply fix a parser.  Bison provides two different
413 representation of it, either textually or graphically (as a DOT file).
414
415    The textual file is generated when the options `--report' or
416 `--verbose' are specified, see *note Invoking Bison: Invocation.  Its
417 name is made by removing `.tab.c' or `.c' from the parser
418 implementation file name, and adding `.output' instead.  Therefore, if
419 the grammar file is `foo.y', then the parser implementation file is
420 called `foo.tab.c' by default.  As a consequence, the verbose output
421 file is called `foo.output'.
422
423    The following grammar file, `calc.y', will be used in the sequel:
424
425      %token NUM STR
426      %left '+' '-'
427      %left '*'
428      %%
429      exp:
430        exp '+' exp
431      | exp '-' exp
432      | exp '*' exp
433      | exp '/' exp
434      | NUM
435      ;
436      useless: STR;
437      %%
438
439    `bison' reports:
440
441      calc.y: warning: 1 nonterminal useless in grammar
442      calc.y: warning: 1 rule useless in grammar
443      calc.y:11.1-7: warning: nonterminal useless in grammar: useless
444      calc.y:11.10-12: warning: rule useless in grammar: useless: STR
445      calc.y: conflicts: 7 shift/reduce
446
447    When given `--report=state', in addition to `calc.tab.c', it creates
448 a file `calc.output' with contents detailed below.  The order of the
449 output and the exact presentation might vary, but the interpretation is
450 the same.
451
452 The first section reports useless tokens, nonterminals and rules.
453 Useless nonterminals and rules are removed in order to produce a
454 smaller parser, but useless tokens are preserved, since they might be
455 used by the scanner (note the difference between "useless" and "unused"
456 below):
457
458      Nonterminals useless in grammar
459         useless
460
461      Terminals unused in grammar
462         STR
463
464      Rules useless in grammar
465          6 useless: STR
466
467 The next section lists states that still have conflicts.
468
469      State 8 conflicts: 1 shift/reduce
470      State 9 conflicts: 1 shift/reduce
471      State 10 conflicts: 1 shift/reduce
472      State 11 conflicts: 4 shift/reduce
473
474 Then Bison reproduces the exact grammar it used:
475
476      Grammar
477
478          0 $accept: exp $end
479
480          1 exp: exp '+' exp
481          2    | exp '-' exp
482          3    | exp '*' exp
483          4    | exp '/' exp
484          5    | NUM
485
486 and reports the uses of the symbols:
487
488      Terminals, with rules where they appear
489
490      $end (0) 0
491      '*' (42) 3
492      '+' (43) 1
493      '-' (45) 2
494      '/' (47) 4
495      error (256)
496      NUM (258) 5
497      STR (259)
498
499      Nonterminals, with rules where they appear
500
501      $accept (9)
502          on left: 0
503      exp (10)
504          on left: 1 2 3 4 5, on right: 0 1 2 3 4
505
506 Bison then proceeds onto the automaton itself, describing each state
507 with its set of "items", also known as "pointed rules".  Each item is a
508 production rule together with a point (`.') marking the location of the
509 input cursor.
510
511      state 0
512
513          0 $accept: . exp $end
514
515          NUM  shift, and go to state 1
516
517          exp  go to state 2
518
519    This reads as follows: "state 0 corresponds to being at the very
520 beginning of the parsing, in the initial rule, right before the start
521 symbol (here, `exp').  When the parser returns to this state right
522 after having reduced a rule that produced an `exp', the control flow
523 jumps to state 2.  If there is no such transition on a nonterminal
524 symbol, and the lookahead is a `NUM', then this token is shifted onto
525 the parse stack, and the control flow jumps to state 1.  Any other
526 lookahead triggers a syntax error."
527
528    Even though the only active rule in state 0 seems to be rule 0, the
529 report lists `NUM' as a lookahead token because `NUM' can be at the
530 beginning of any rule deriving an `exp'.  By default Bison reports the
531 so-called "core" or "kernel" of the item set, but if you want to see
532 more detail you can invoke `bison' with `--report=itemset' to list the
533 derived items as well:
534
535      state 0
536
537          0 $accept: . exp $end
538          1 exp: . exp '+' exp
539          2    | . exp '-' exp
540          3    | . exp '*' exp
541          4    | . exp '/' exp
542          5    | . NUM
543
544          NUM  shift, and go to state 1
545
546          exp  go to state 2
547
548 In the state 1...
549
550      state 1
551
552          5 exp: NUM .
553
554          $default  reduce using rule 5 (exp)
555
556 the rule 5, `exp: NUM;', is completed.  Whatever the lookahead token
557 (`$default'), the parser will reduce it.  If it was coming from state
558 0, then, after this reduction it will return to state 0, and will jump
559 to state 2 (`exp: go to state 2').
560
561      state 2
562
563          0 $accept: exp . $end
564          1 exp: exp . '+' exp
565          2    | exp . '-' exp
566          3    | exp . '*' exp
567          4    | exp . '/' exp
568
569          $end  shift, and go to state 3
570          '+'   shift, and go to state 4
571          '-'   shift, and go to state 5
572          '*'   shift, and go to state 6
573          '/'   shift, and go to state 7
574
575 In state 2, the automaton can only shift a symbol.  For instance,
576 because of the item `exp: exp . '+' exp', if the lookahead is `+' it is
577 shifted onto the parse stack, and the automaton jumps to state 4,
578 corresponding to the item `exp: exp '+' . exp'.  Since there is no
579 default action, any lookahead not listed triggers a syntax error.
580
581    The state 3 is named the "final state", or the "accepting state":
582
583      state 3
584
585          0 $accept: exp $end .
586
587          $default  accept
588
589 the initial rule is completed (the start symbol and the end-of-input
590 were read), the parsing exits successfully.
591
592    The interpretation of states 4 to 7 is straightforward, and is left
593 to the reader.
594
595      state 4
596
597          1 exp: exp '+' . exp
598
599          NUM  shift, and go to state 1
600
601          exp  go to state 8
602
603
604      state 5
605
606          2 exp: exp '-' . exp
607
608          NUM  shift, and go to state 1
609
610          exp  go to state 9
611
612
613      state 6
614
615          3 exp: exp '*' . exp
616
617          NUM  shift, and go to state 1
618
619          exp  go to state 10
620
621
622      state 7
623
624          4 exp: exp '/' . exp
625
626          NUM  shift, and go to state 1
627
628          exp  go to state 11
629
630    As was announced in beginning of the report, `State 8 conflicts: 1
631 shift/reduce':
632
633      state 8
634
635          1 exp: exp . '+' exp
636          1    | exp '+' exp .
637          2    | exp . '-' exp
638          3    | exp . '*' exp
639          4    | exp . '/' exp
640
641          '*'  shift, and go to state 6
642          '/'  shift, and go to state 7
643
644          '/'       [reduce using rule 1 (exp)]
645          $default  reduce using rule 1 (exp)
646
647    Indeed, there are two actions associated to the lookahead `/':
648 either shifting (and going to state 7), or reducing rule 1.  The
649 conflict means that either the grammar is ambiguous, or the parser lacks
650 information to make the right decision.  Indeed the grammar is
651 ambiguous, as, since we did not specify the precedence of `/', the
652 sentence `NUM + NUM / NUM' can be parsed as `NUM + (NUM / NUM)', which
653 corresponds to shifting `/', or as `(NUM + NUM) / NUM', which
654 corresponds to reducing rule 1.
655
656    Because in deterministic parsing a single decision can be made, Bison
657 arbitrarily chose to disable the reduction, see *note Shift/Reduce
658 Conflicts: Shift/Reduce.  Discarded actions are reported between square
659 brackets.
660
661    Note that all the previous states had a single possible action:
662 either shifting the next token and going to the corresponding state, or
663 reducing a single rule.  In the other cases, i.e., when shifting _and_
664 reducing is possible or when _several_ reductions are possible, the
665 lookahead is required to select the action.  State 8 is one such state:
666 if the lookahead is `*' or `/' then the action is shifting, otherwise
667 the action is reducing rule 1.  In other words, the first two items,
668 corresponding to rule 1, are not eligible when the lookahead token is
669 `*', since we specified that `*' has higher precedence than `+'.  More
670 generally, some items are eligible only with some set of possible
671 lookahead tokens.  When run with `--report=lookahead', Bison specifies
672 these lookahead tokens:
673
674      state 8
675
676          1 exp: exp . '+' exp
677          1    | exp '+' exp .  [$end, '+', '-', '/']
678          2    | exp . '-' exp
679          3    | exp . '*' exp
680          4    | exp . '/' exp
681
682          '*'  shift, and go to state 6
683          '/'  shift, and go to state 7
684
685          '/'       [reduce using rule 1 (exp)]
686          $default  reduce using rule 1 (exp)
687
688    Note however that while `NUM + NUM / NUM' is ambiguous (which
689 results in the conflicts on `/'), `NUM + NUM * NUM' is not: the
690 conflict was solved thanks to associativity and precedence directives.
691 If invoked with `--report=solved', Bison includes information about the
692 solved conflicts in the report:
693
694      Conflict between rule 1 and token '+' resolved as reduce (%left '+').
695      Conflict between rule 1 and token '-' resolved as reduce (%left '-').
696      Conflict between rule 1 and token '*' resolved as shift ('+' < '*').
697
698    The remaining states are similar:
699
700      state 9
701
702          1 exp: exp . '+' exp
703          2    | exp . '-' exp
704          2    | exp '-' exp .
705          3    | exp . '*' exp
706          4    | exp . '/' exp
707
708          '*'  shift, and go to state 6
709          '/'  shift, and go to state 7
710
711          '/'       [reduce using rule 2 (exp)]
712          $default  reduce using rule 2 (exp)
713
714      state 10
715
716          1 exp: exp . '+' exp
717          2    | exp . '-' exp
718          3    | exp . '*' exp
719          3    | exp '*' exp .
720          4    | exp . '/' exp
721
722          '/'  shift, and go to state 7
723
724          '/'       [reduce using rule 3 (exp)]
725          $default  reduce using rule 3 (exp)
726
727      state 11
728
729          1 exp: exp . '+' exp
730          2    | exp . '-' exp
731          3    | exp . '*' exp
732          4    | exp . '/' exp
733          4    | exp '/' exp .
734
735          '+'  shift, and go to state 4
736          '-'  shift, and go to state 5
737          '*'  shift, and go to state 6
738          '/'  shift, and go to state 7
739
740          '+'       [reduce using rule 4 (exp)]
741          '-'       [reduce using rule 4 (exp)]
742          '*'       [reduce using rule 4 (exp)]
743          '/'       [reduce using rule 4 (exp)]
744          $default  reduce using rule 4 (exp)
745
746 Observe that state 11 contains conflicts not only due to the lack of
747 precedence of `/' with respect to `+', `-', and `*', but also because
748 the associativity of `/' is not specified.
749
750 \1f
751 File: bison.info,  Node: Tracing,  Prev: Understanding,  Up: Debugging
752
753 8.2 Tracing Your Parser
754 =======================
755
756 When a Bison grammar compiles properly but parses "incorrectly", the
757 `yydebug' parser-trace feature helps figuring out why.
758
759 * Menu:
760
761 * Enabling Traces::    Activating run-time trace support
762 * Mfcalc Traces::      Extending `mfcalc' to support traces
763 * The YYPRINT Macro::  Obsolete interface for semantic value reports
764
765 \1f
766 File: bison.info,  Node: Enabling Traces,  Next: Mfcalc Traces,  Up: Tracing
767
768 8.2.1 Enabling Traces
769 ---------------------
770
771 There are several means to enable compilation of trace facilities:
772
773 the macro `YYDEBUG'
774      Define the macro `YYDEBUG' to a nonzero value when you compile the
775      parser.  This is compliant with POSIX Yacc.  You could use
776      `-DYYDEBUG=1' as a compiler option or you could put `#define
777      YYDEBUG 1' in the prologue of the grammar file (*note The
778      Prologue: Prologue.).
779
780      If the `%define' variable `api.prefix' is used (*note Multiple
781      Parsers in the Same Program: Multiple Parsers.), for instance
782      `%define api.prefix x', then if `CDEBUG' is defined, its value
783      controls the tracing feature (enabled iff nonzero); otherwise
784      tracing is enabled iff `YYDEBUG' is nonzero.
785
786 the option `-t' (POSIX Yacc compliant)
787 the option `--debug' (Bison extension)
788      Use the `-t' option when you run Bison (*note Invoking Bison:
789      Invocation.).  With `%define api.prefix c', it defines `CDEBUG' to
790      1, otherwise it defines `YYDEBUG' to 1.
791
792 the directive `%debug'
793      Add the `%debug' directive (*note Bison Declaration Summary: Decl
794      Summary.).  This is a Bison extension, especially useful for
795      languages that don't use a preprocessor.  Unless POSIX and Yacc
796      portability matter to you, this is the preferred solution.
797
798    We suggest that you always enable the debug option so that debugging
799 is always possible.
800
801    The trace facility outputs messages with macro calls of the form
802 `YYFPRINTF (stderr, FORMAT, ARGS)' where FORMAT and ARGS are the usual
803 `printf' format and variadic arguments.  If you define `YYDEBUG' to a
804 nonzero value but do not define `YYFPRINTF', `<stdio.h>' is
805 automatically included and `YYFPRINTF' is defined to `fprintf'.
806
807    Once you have compiled the program with trace facilities, the way to
808 request a trace is to store a nonzero value in the variable `yydebug'.
809 You can do this by making the C code do it (in `main', perhaps), or you
810 can alter the value with a C debugger.
811
812    Each step taken by the parser when `yydebug' is nonzero produces a
813 line or two of trace information, written on `stderr'.  The trace
814 messages tell you these things:
815
816    * Each time the parser calls `yylex', what kind of token was read.
817
818    * Each time a token is shifted, the depth and complete contents of
819      the state stack (*note Parser States::).
820
821    * Each time a rule is reduced, which rule it is, and the complete
822      contents of the state stack afterward.
823
824    To make sense of this information, it helps to refer to the automaton
825 description file (*note Understanding Your Parser: Understanding.).
826 This file shows the meaning of each state in terms of positions in
827 various rules, and also what each state will do with each possible
828 input token.  As you read the successive trace messages, you can see
829 that the parser is functioning according to its specification in the
830 listing file.  Eventually you will arrive at the place where something
831 undesirable happens, and you will see which parts of the grammar are to
832 blame.
833
834    The parser implementation file is a C/C++/Java program and you can
835 use debuggers on it, but it's not easy to interpret what it is doing.
836 The parser function is a finite-state machine interpreter, and aside
837 from the actions it executes the same code over and over.  Only the
838 values of variables show where in the grammar it is working.
839
840 \1f
841 File: bison.info,  Node: Mfcalc Traces,  Next: The YYPRINT Macro,  Prev: Enabling Traces,  Up: Tracing
842
843 8.2.2 Enabling Debug Traces for `mfcalc'
844 ----------------------------------------
845
846 The debugging information normally gives the token type of each token
847 read, but not its semantic value.  The `%printer' directive allows
848 specify how semantic values are reported, see *note Printing Semantic
849 Values: Printer Decl.  For backward compatibility, Yacc like C parsers
850 may also use the `YYPRINT' (*note The `YYPRINT' Macro: The YYPRINT
851 Macro.), but its use is discouraged.
852
853    As a demonstration of `%printer', consider the multi-function
854 calculator, `mfcalc' (*note Multi-function Calc::).  To enable run-time
855 traces, and semantic value reports, insert the following directives in
856 its prologue:
857
858      /* Generate the parser description file.  */
859      %verbose
860      /* Enable run-time traces (yydebug).  */
861      %define parse.trace
862
863      /* Formatting semantic values.  */
864      %printer { fprintf (yyoutput, "%s", $$->name); } VAR;
865      %printer { fprintf (yyoutput, "%s()", $$->name); } FNCT;
866      %printer { fprintf (yyoutput, "%g", $$); } <val>;
867
868    The `%define' directive instructs Bison to generate run-time trace
869 support.  Then, activation of these traces is controlled at run-time by
870 the `yydebug' variable, which is disabled by default.  Because these
871 traces will refer to the "states" of the parser, it is helpful to ask
872 for the creation of a description of that parser; this is the purpose
873 of (admittedly ill-named) `%verbose' directive.
874
875    The set of `%printer' directives demonstrates how to format the
876 semantic value in the traces.  Note that the specification can be done
877 either on the symbol type (e.g., `VAR' or `FNCT'), or on the type tag:
878 since `<val>' is the type for both `NUM' and `exp', this printer will
879 be used for them.
880
881    Here is a sample of the information provided by run-time traces.
882 The traces are sent onto standard error.
883
884      $ echo 'sin(1-1)' | ./mfcalc -p
885      Starting parse
886      Entering state 0
887      Reducing stack by rule 1 (line 34):
888      -> $$ = nterm input ()
889      Stack now 0
890      Entering state 1
891
892 This first batch shows a specific feature of this grammar: the first
893 rule (which is in line 34 of `mfcalc.y' can be reduced without even
894 having to look for the first token.  The resulting left-hand symbol
895 (`$$') is a valueless (`()') `input' non terminal (`nterm').
896
897    Then the parser calls the scanner.
898      Reading a token: Next token is token FNCT (sin())
899      Shifting token FNCT (sin())
900      Entering state 6
901
902 That token (`token') is a function (`FNCT') whose value is `sin' as
903 formatted per our `%printer' specification: `sin()'.  The parser stores
904 (`Shifting') that token, and others, until it can do something about it.
905
906      Reading a token: Next token is token '(' ()
907      Shifting token '(' ()
908      Entering state 14
909      Reading a token: Next token is token NUM (1.000000)
910      Shifting token NUM (1.000000)
911      Entering state 4
912      Reducing stack by rule 6 (line 44):
913         $1 = token NUM (1.000000)
914      -> $$ = nterm exp (1.000000)
915      Stack now 0 1 6 14
916      Entering state 24
917
918 The previous reduction demonstrates the `%printer' directive for
919 `<val>': both the token `NUM' and the resulting non-terminal `exp' have
920 `1' as value.
921
922      Reading a token: Next token is token '-' ()
923      Shifting token '-' ()
924      Entering state 17
925      Reading a token: Next token is token NUM (1.000000)
926      Shifting token NUM (1.000000)
927      Entering state 4
928      Reducing stack by rule 6 (line 44):
929         $1 = token NUM (1.000000)
930      -> $$ = nterm exp (1.000000)
931      Stack now 0 1 6 14 24 17
932      Entering state 26
933      Reading a token: Next token is token ')' ()
934      Reducing stack by rule 11 (line 49):
935         $1 = nterm exp (1.000000)
936         $2 = token '-' ()
937         $3 = nterm exp (1.000000)
938      -> $$ = nterm exp (0.000000)
939      Stack now 0 1 6 14
940      Entering state 24
941
942 The rule for the subtraction was just reduced.  The parser is about to
943 discover the end of the call to `sin'.
944
945      Next token is token ')' ()
946      Shifting token ')' ()
947      Entering state 31
948      Reducing stack by rule 9 (line 47):
949         $1 = token FNCT (sin())
950         $2 = token '(' ()
951         $3 = nterm exp (0.000000)
952         $4 = token ')' ()
953      -> $$ = nterm exp (0.000000)
954      Stack now 0 1
955      Entering state 11
956
957 Finally, the end-of-line allow the parser to complete the computation,
958 and display its result.
959
960      Reading a token: Next token is token '\n' ()
961      Shifting token '\n' ()
962      Entering state 22
963      Reducing stack by rule 4 (line 40):
964         $1 = nterm exp (0.000000)
965         $2 = token '\n' ()
966      => 0
967      -> $$ = nterm line ()
968      Stack now 0 1
969      Entering state 10
970      Reducing stack by rule 2 (line 35):
971         $1 = nterm input ()
972         $2 = nterm line ()
973      -> $$ = nterm input ()
974      Stack now 0
975      Entering state 1
976
977    The parser has returned into state 1, in which it is waiting for the
978 next expression to evaluate, or for the end-of-file token, which causes
979 the completion of the parsing.
980
981      Reading a token: Now at end of input.
982      Shifting token $end ()
983      Entering state 2
984      Stack now 0 1 2
985      Cleanup: popping token $end ()
986      Cleanup: popping nterm input ()
987
988 \1f
989 File: bison.info,  Node: The YYPRINT Macro,  Prev: Mfcalc Traces,  Up: Tracing
990
991 8.2.3 The `YYPRINT' Macro
992 -------------------------
993
994 Before `%printer' support, semantic values could be displayed using the
995 `YYPRINT' macro, which works only for terminal symbols and only with
996 the `yacc.c' skeleton.
997
998  -- Macro: YYPRINT (STREAM, TOKEN, VALUE);
999      If you define `YYPRINT', it should take three arguments.  The
1000      parser will pass a standard I/O stream, the numeric code for the
1001      token type, and the token value (from `yylval').
1002
1003      For `yacc.c' only.  Obsoleted by `%printer'.
1004
1005    Here is an example of `YYPRINT' suitable for the multi-function
1006 calculator (*note Declarations for `mfcalc': Mfcalc Declarations.):
1007
1008      %{
1009        static void print_token_value (FILE *, int, YYSTYPE);
1010        #define YYPRINT(File, Type, Value)            \
1011          print_token_value (File, Type, Value)
1012      %}
1013
1014      ... %% ... %% ...
1015
1016      static void
1017      print_token_value (FILE *file, int type, YYSTYPE value)
1018      {
1019        if (type == VAR)
1020          fprintf (file, "%s", value.tptr->name);
1021        else if (type == NUM)
1022          fprintf (file, "%d", value.val);
1023      }
1024
1025 \1f
1026 File: bison.info,  Node: Invocation,  Next: Other Languages,  Prev: Debugging,  Up: Top
1027
1028 9 Invoking Bison
1029 ****************
1030
1031 The usual way to invoke Bison is as follows:
1032
1033      bison INFILE
1034
1035    Here INFILE is the grammar file name, which usually ends in `.y'.
1036 The parser implementation file's name is made by replacing the `.y'
1037 with `.tab.c' and removing any leading directory.  Thus, the `bison
1038 foo.y' file name yields `foo.tab.c', and the `bison hack/foo.y' file
1039 name yields `foo.tab.c'.  It's also possible, in case you are writing
1040 C++ code instead of C in your grammar file, to name it `foo.ypp' or
1041 `foo.y++'.  Then, the output files will take an extension like the
1042 given one as input (respectively `foo.tab.cpp' and `foo.tab.c++').  This
1043 feature takes effect with all options that manipulate file names like
1044 `-o' or `-d'.
1045
1046    For example :
1047
1048      bison -d INFILE.YXX
1049    will produce `infile.tab.cxx' and `infile.tab.hxx', and
1050
1051      bison -d -o OUTPUT.C++ INFILE.Y
1052    will produce `output.c++' and `outfile.h++'.
1053
1054    For compatibility with POSIX, the standard Bison distribution also
1055 contains a shell script called `yacc' that invokes Bison with the `-y'
1056 option.
1057
1058 * Menu:
1059
1060 * Bison Options::     All the options described in detail,
1061                         in alphabetical order by short options.
1062 * Option Cross Key::  Alphabetical list of long options.
1063 * Yacc Library::      Yacc-compatible `yylex' and `main'.
1064
1065 \1f
1066 File: bison.info,  Node: Bison Options,  Next: Option Cross Key,  Up: Invocation
1067
1068 9.1 Bison Options
1069 =================
1070
1071 Bison supports both traditional single-letter options and mnemonic long
1072 option names.  Long option names are indicated with `--' instead of
1073 `-'.  Abbreviations for option names are allowed as long as they are
1074 unique.  When a long option takes an argument, like `--file-prefix',
1075 connect the option name and the argument with `='.
1076
1077    Here is a list of options that can be used with Bison, alphabetized
1078 by short option.  It is followed by a cross key alphabetized by long
1079 option.
1080
1081 Operations modes:
1082 `-h'
1083 `--help'
1084      Print a summary of the command-line options to Bison and exit.
1085
1086 `-V'
1087 `--version'
1088      Print the version number of Bison and exit.
1089
1090 `--print-localedir'
1091      Print the name of the directory containing locale-dependent data.
1092
1093 `--print-datadir'
1094      Print the name of the directory containing skeletons and XSLT.
1095
1096 `-y'
1097 `--yacc'
1098      Act more like the traditional Yacc command.  This can cause
1099      different diagnostics to be generated, and may change behavior in
1100      other minor ways.  Most importantly, imitate Yacc's output file
1101      name conventions, so that the parser implementation file is called
1102      `y.tab.c', and the other outputs are called `y.output' and
1103      `y.tab.h'.  Also, if generating a deterministic parser in C,
1104      generate `#define' statements in addition to an `enum' to associate
1105      token numbers with token names.  Thus, the following shell script
1106      can substitute for Yacc, and the Bison distribution contains such
1107      a script for compatibility with POSIX:
1108
1109           #! /bin/sh
1110           bison -y "$@"
1111
1112      The `-y'/`--yacc' option is intended for use with traditional Yacc
1113      grammars.  If your grammar uses a Bison extension like
1114      `%glr-parser', Bison might not be Yacc-compatible even if this
1115      option is specified.
1116
1117 `-W [CATEGORY]'
1118 `--warnings[=CATEGORY]'
1119      Output warnings falling in CATEGORY.  CATEGORY can be one of:
1120     `midrule-values'
1121           Warn about mid-rule values that are set but not used within
1122           any of the actions of the parent rule.  For example, warn
1123           about unused `$2' in:
1124
1125                exp: '1' { $$ = 1; } '+' exp { $$ = $1 + $4; };
1126
1127           Also warn about mid-rule values that are used but not set.
1128           For example, warn about unset `$$' in the mid-rule action in:
1129
1130                exp: '1' { $1 = 1; } '+' exp { $$ = $2 + $4; };
1131
1132           These warnings are not enabled by default since they
1133           sometimes prove to be false alarms in existing grammars
1134           employing the Yacc constructs `$0' or `$-N' (where N is some
1135           positive integer).
1136
1137     `yacc'
1138           Incompatibilities with POSIX Yacc.
1139
1140     `conflicts-sr'
1141     `conflicts-rr'
1142           S/R and R/R conflicts.  These warnings are enabled by
1143           default.  However, if the `%expect' or `%expect-rr' directive
1144           is specified, an unexpected number of conflicts is an error,
1145           and an expected number of conflicts is not reported, so `-W'
1146           and `--warning' then have no effect on the conflict report.
1147
1148     `other'
1149           All warnings not categorized above.  These warnings are
1150           enabled by default.
1151
1152           This category is provided merely for the sake of
1153           completeness.  Future releases of Bison may move warnings
1154           from this category to new, more specific categories.
1155
1156     `all'
1157           All the warnings.
1158
1159     `none'
1160           Turn off all the warnings.
1161
1162     `error'
1163           Treat warnings as errors.
1164
1165      A category can be turned off by prefixing its name with `no-'.  For
1166      instance, `-Wno-yacc' will hide the warnings about POSIX Yacc
1167      incompatibilities.
1168
1169 Tuning the parser:
1170
1171 `-t'
1172 `--debug'
1173      In the parser implementation file, define the macro `YYDEBUG' to 1
1174      if it is not already defined, so that the debugging facilities are
1175      compiled.  *Note Tracing Your Parser: Tracing.
1176
1177 `-D NAME[=VALUE]'
1178 `--define=NAME[=VALUE]'
1179 `-F NAME[=VALUE]'
1180 `--force-define=NAME[=VALUE]'
1181      Each of these is equivalent to `%define NAME "VALUE"' (*note
1182      %define Summary::) except that Bison processes multiple
1183      definitions for the same NAME as follows:
1184
1185         * Bison quietly ignores all command-line definitions for NAME
1186           except the last.
1187
1188         * If that command-line definition is specified by a `-D' or
1189           `--define', Bison reports an error for any `%define'
1190           definition for NAME.
1191
1192         * If that command-line definition is specified by a `-F' or
1193           `--force-define' instead, Bison quietly ignores all `%define'
1194           definitions for NAME.
1195
1196         * Otherwise, Bison reports an error if there are multiple
1197           `%define' definitions for NAME.
1198
1199      You should avoid using `-F' and `--force-define' in your make
1200      files unless you are confident that it is safe to quietly ignore
1201      any conflicting `%define' that may be added to the grammar file.
1202
1203 `-L LANGUAGE'
1204 `--language=LANGUAGE'
1205      Specify the programming language for the generated parser, as if
1206      `%language' was specified (*note Bison Declaration Summary: Decl
1207      Summary.).  Currently supported languages include C, C++, and Java.
1208      LANGUAGE is case-insensitive.
1209
1210      This option is experimental and its effect may be modified in
1211      future releases.
1212
1213 `--locations'
1214      Pretend that `%locations' was specified.  *Note Decl Summary::.
1215
1216 `-p PREFIX'
1217 `--name-prefix=PREFIX'
1218      Pretend that `%name-prefix "PREFIX"' was specified (*note Decl
1219      Summary::).  Obsoleted by `-Dapi.prefix=PREFIX'.  *Note Multiple
1220      Parsers in the Same Program: Multiple Parsers.
1221
1222 `-l'
1223 `--no-lines'
1224      Don't put any `#line' preprocessor commands in the parser
1225      implementation file.  Ordinarily Bison puts them in the parser
1226      implementation file so that the C compiler and debuggers will
1227      associate errors with your source file, the grammar file.  This
1228      option causes them to associate errors with the parser
1229      implementation file, treating it as an independent source file in
1230      its own right.
1231
1232 `-S FILE'
1233 `--skeleton=FILE'
1234      Specify the skeleton to use, similar to `%skeleton' (*note Bison
1235      Declaration Summary: Decl Summary.).
1236
1237      If FILE does not contain a `/', FILE is the name of a skeleton
1238      file in the Bison installation directory.  If it does, FILE is an
1239      absolute file name or a file name relative to the current working
1240      directory.  This is similar to how most shells resolve commands.
1241
1242 `-k'
1243 `--token-table'
1244      Pretend that `%token-table' was specified.  *Note Decl Summary::.
1245
1246 Adjust the output:
1247
1248 `--defines[=FILE]'
1249      Pretend that `%defines' was specified, i.e., write an extra output
1250      file containing macro definitions for the token type names defined
1251      in the grammar, as well as a few other declarations.  *Note Decl
1252      Summary::.
1253
1254 `-d'
1255      This is the same as `--defines' except `-d' does not accept a FILE
1256      argument since POSIX Yacc requires that `-d' can be bundled with
1257      other short options.
1258
1259 `-b FILE-PREFIX'
1260 `--file-prefix=PREFIX'
1261      Pretend that `%file-prefix' was specified, i.e., specify prefix to
1262      use for all Bison output file names.  *Note Decl Summary::.
1263
1264 `-r THINGS'
1265 `--report=THINGS'
1266      Write an extra output file containing verbose description of the
1267      comma separated list of THINGS among:
1268
1269     `state'
1270           Description of the grammar, conflicts (resolved and
1271           unresolved), and parser's automaton.
1272
1273     `lookahead'
1274           Implies `state' and augments the description of the automaton
1275           with each rule's lookahead set.
1276
1277     `itemset'
1278           Implies `state' and augments the description of the automaton
1279           with the full set of items for each state, instead of its
1280           core only.
1281
1282 `--report-file=FILE'
1283      Specify the FILE for the verbose description.
1284
1285 `-v'
1286 `--verbose'
1287      Pretend that `%verbose' was specified, i.e., write an extra output
1288      file containing verbose descriptions of the grammar and parser.
1289      *Note Decl Summary::.
1290
1291 `-o FILE'
1292 `--output=FILE'
1293      Specify the FILE for the parser implementation file.
1294
1295      The other output files' names are constructed from FILE as
1296      described under the `-v' and `-d' options.
1297
1298 `-g [FILE]'
1299 `--graph[=FILE]'
1300      Output a graphical representation of the parser's automaton
1301      computed by Bison, in Graphviz (http://www.graphviz.org/) DOT
1302      (http://www.graphviz.org/doc/info/lang.html) format.  `FILE' is
1303      optional.  If omitted and the grammar file is `foo.y', the output
1304      file will be `foo.dot'.
1305
1306 `-x [FILE]'
1307 `--xml[=FILE]'
1308      Output an XML report of the parser's automaton computed by Bison.
1309      `FILE' is optional.  If omitted and the grammar file is `foo.y',
1310      the output file will be `foo.xml'.  (The current XML schema is
1311      experimental and may evolve.  More user feedback will help to
1312      stabilize it.)
1313
1314 \1f
1315 File: bison.info,  Node: Option Cross Key,  Next: Yacc Library,  Prev: Bison Options,  Up: Invocation
1316
1317 9.2 Option Cross Key
1318 ====================
1319
1320 Here is a list of options, alphabetized by long option, to help you find
1321 the corresponding short option and directive.
1322
1323 Long Option                     Short Option        Bison Directive
1324 --------------------------------------------------------------------------------- 
1325 `--debug'                       `-t'                `%debug'
1326 `--define=NAME[=VALUE]'         `-D NAME[=VALUE]'   `%define NAME ["VALUE"]'
1327 `--defines[=FILE]'              `-d'                `%defines ["FILE"]'
1328 `--file-prefix=PREFIX'          `-b PREFIX'         `%file-prefix "PREFIX"'
1329 `--force-define=NAME[=VALUE]'   `-F NAME[=VALUE]'   `%define NAME ["VALUE"]'
1330 `--graph[=FILE]'                `-g [FILE]'         
1331 `--help'                        `-h'                
1332 `--language=LANGUAGE'           `-L LANGUAGE'       `%language "LANGUAGE"'
1333 `--locations'                                       `%locations'
1334 `--name-prefix=PREFIX'          `-p PREFIX'         `%name-prefix "PREFIX"'
1335 `--no-lines'                    `-l'                `%no-lines'
1336 `--output=FILE'                 `-o FILE'           `%output "FILE"'
1337 `--print-datadir'                                   
1338 `--print-localedir'                                 
1339 `--report-file=FILE'                                
1340 `--report=THINGS'               `-r THINGS'         
1341 `--skeleton=FILE'               `-S FILE'           `%skeleton "FILE"'
1342 `--token-table'                 `-k'                `%token-table'
1343 `--verbose'                     `-v'                `%verbose'
1344 `--version'                     `-V'                
1345 `--warnings[=CATEGORY]'         `-W [CATEGORY]'     
1346 `--xml[=FILE]'                  `-x [FILE]'         
1347 `--yacc'                        `-y'                `%yacc'
1348
1349 \1f
1350 File: bison.info,  Node: Yacc Library,  Prev: Option Cross Key,  Up: Invocation
1351
1352 9.3 Yacc Library
1353 ================
1354
1355 The Yacc library contains default implementations of the `yyerror' and
1356 `main' functions.  These default implementations are normally not
1357 useful, but POSIX requires them.  To use the Yacc library, link your
1358 program with the `-ly' option.  Note that Bison's implementation of the
1359 Yacc library is distributed under the terms of the GNU General Public
1360 License (*note Copying::).
1361
1362    If you use the Yacc library's `yyerror' function, you should declare
1363 `yyerror' as follows:
1364
1365      int yyerror (char const *);
1366
1367    Bison ignores the `int' value returned by this `yyerror'.  If you
1368 use the Yacc library's `main' function, your `yyparse' function should
1369 have the following type signature:
1370
1371      int yyparse (void);
1372
1373 \1f
1374 File: bison.info,  Node: Other Languages,  Next: FAQ,  Prev: Invocation,  Up: Top
1375
1376 10 Parsers Written In Other Languages
1377 *************************************
1378
1379 * Menu:
1380
1381 * C++ Parsers::                 The interface to generate C++ parser classes
1382 * Java Parsers::                The interface to generate Java parser classes
1383
1384 \1f
1385 File: bison.info,  Node: C++ Parsers,  Next: Java Parsers,  Up: Other Languages
1386
1387 10.1 C++ Parsers
1388 ================
1389
1390 * Menu:
1391
1392 * C++ Bison Interface::         Asking for C++ parser generation
1393 * C++ Semantic Values::         %union vs. C++
1394 * C++ Location Values::         The position and location classes
1395 * C++ Parser Interface::        Instantiating and running the parser
1396 * C++ Scanner Interface::       Exchanges between yylex and parse
1397 * A Complete C++ Example::      Demonstrating their use
1398
1399 \1f
1400 File: bison.info,  Node: C++ Bison Interface,  Next: C++ Semantic Values,  Up: C++ Parsers
1401
1402 10.1.1 C++ Bison Interface
1403 --------------------------
1404
1405 The C++ deterministic parser is selected using the skeleton directive,
1406 `%skeleton "lalr1.cc"', or the synonymous command-line option
1407 `--skeleton=lalr1.cc'.  *Note Decl Summary::.
1408
1409    When run, `bison' will create several entities in the `yy' namespace.  Use
1410 the `%define namespace' directive to change the namespace name, see
1411 *note namespace: %define Summary.  The various classes are generated in
1412 the following files:
1413
1414 `position.hh'
1415 `location.hh'
1416      The definition of the classes `position' and `location', used for
1417      location tracking.  *Note C++ Location Values::.
1418
1419 `stack.hh'
1420      An auxiliary class `stack' used by the parser.
1421
1422 `FILE.hh'
1423 `FILE.cc'
1424      (Assuming the extension of the grammar file was `.yy'.)  The
1425      declaration and implementation of the C++ parser class.  The
1426      basename and extension of these two files follow the same rules as
1427      with regular C parsers (*note Invocation::).
1428
1429      The header is _mandatory_; you must either pass `-d'/`--defines'
1430      to `bison', or use the `%defines' directive.
1431
1432    All these files are documented using Doxygen; run `doxygen' for a
1433 complete and accurate documentation.
1434
1435 \1f
1436 File: bison.info,  Node: C++ Semantic Values,  Next: C++ Location Values,  Prev: C++ Bison Interface,  Up: C++ Parsers
1437
1438 10.1.2 C++ Semantic Values
1439 --------------------------
1440
1441 The `%union' directive works as for C, see *note The Collection of
1442 Value Types: Union Decl.  In particular it produces a genuine
1443 `union'(1), which have a few specific features in C++.
1444    - The type `YYSTYPE' is defined but its use is discouraged: rather
1445      you should refer to the parser's encapsulated type
1446      `yy::parser::semantic_type'.
1447
1448    - Non POD (Plain Old Data) types cannot be used.  C++ forbids any
1449      instance of classes with constructors in unions: only _pointers_
1450      to such objects are allowed.
1451
1452    Because objects have to be stored via pointers, memory is not
1453 reclaimed automatically: using the `%destructor' directive is the only
1454 means to avoid leaks.  *Note Freeing Discarded Symbols: Destructor Decl.
1455
1456    ---------- Footnotes ----------
1457
1458    (1) In the future techniques to allow complex types within
1459 pseudo-unions (similar to Boost variants) might be implemented to
1460 alleviate these issues.
1461
1462 \1f
1463 File: bison.info,  Node: C++ Location Values,  Next: C++ Parser Interface,  Prev: C++ Semantic Values,  Up: C++ Parsers
1464
1465 10.1.3 C++ Location Values
1466 --------------------------
1467
1468 When the directive `%locations' is used, the C++ parser supports
1469 location tracking, see *note Tracking Locations::.  Two auxiliary
1470 classes define a `position', a single point in a file, and a
1471 `location', a range composed of a pair of `position's (possibly
1472 spanning several files).
1473
1474    In this section `uint' is an abbreviation for `unsigned int': in
1475 genuine code only the latter is used.
1476
1477 * Menu:
1478
1479 * C++ position::         One point in the source file
1480 * C++ location::         Two points in the source file
1481
1482 \1f
1483 File: bison.info,  Node: C++ position,  Next: C++ location,  Up: C++ Location Values
1484
1485 10.1.3.1 C++ `position'
1486 .......................
1487
1488  -- Constructor on position:  position (std::string* FILE = 0, uint
1489           LINE = 1, uint COL = 1)
1490      Create a `position' denoting a given point.  Note that `file' is
1491      not reclaimed when the `position' is destroyed: memory managed
1492      must be handled elsewhere.
1493
1494  -- Method on position: void initialize (std::string* FILE = 0, uint
1495           LINE = 1, uint COL = 1)
1496      Reset the position to the given values.
1497
1498  -- Instance Variable of position: std::string* file
1499      The name of the file.  It will always be handled as a pointer, the
1500      parser will never duplicate nor deallocate it.  As an experimental
1501      feature you may change it to `TYPE*' using `%define filename_type
1502      "TYPE"'.
1503
1504  -- Instance Variable of position: uint line
1505      The line, starting at 1.
1506
1507  -- Method on position: uint lines (int HEIGHT = 1)
1508      Advance by HEIGHT lines, resetting the column number.
1509
1510  -- Instance Variable of position: uint column
1511      The column, starting at 1.
1512
1513  -- Method on position: uint columns (int WIDTH = 1)
1514      Advance by WIDTH columns, without changing the line number.
1515
1516  -- Method on position: position& operator+= (int WIDTH)
1517  -- Method on position: position operator+ (int WIDTH)
1518  -- Method on position: position& operator-= (int WIDTH)
1519  -- Method on position: position operator- (int WIDTH)
1520      Various forms of syntactic sugar for `columns'.
1521
1522  -- Method on position: bool operator== (const position& THAT)
1523  -- Method on position: bool operator!= (const position& THAT)
1524      Whether `*this' and `that' denote equal/different positions.
1525
1526  -- Function: std::ostream& operator<< (std::ostream& O, const
1527           position& P)
1528      Report P on O like this: `FILE:LINE.COLUMN', or `LINE.COLUMN' if
1529      FILE is null.
1530
1531 \1f
1532 File: bison.info,  Node: C++ location,  Prev: C++ position,  Up: C++ Location Values
1533
1534 10.1.3.2 C++ `location'
1535 .......................
1536
1537  -- Constructor on location:  location (const position& BEGIN, const
1538           position& END)
1539      Create a `Location' from the endpoints of the range.
1540
1541  -- Constructor on location:  location (const position& POS =
1542           position())
1543  -- Constructor on location:  location (std::string* FILE, uint LINE,
1544           uint COL)
1545      Create a `Location' denoting an empty range located at a given
1546      point.
1547
1548  -- Method on location: void initialize (std::string* FILE = 0, uint
1549           LINE = 1, uint COL = 1)
1550      Reset the location to an empty range at the given values.
1551
1552  -- Instance Variable of location: position begin
1553  -- Instance Variable of location: position end
1554      The first, inclusive, position of the range, and the first beyond.
1555
1556  -- Method on location: uint columns (int WIDTH = 1)
1557  -- Method on location: uint lines (int HEIGHT = 1)
1558      Advance the `end' position.
1559
1560  -- Method on location: location operator+ (const location& END)
1561  -- Method on location: location operator+ (int WIDTH)
1562  -- Method on location: location operator+= (int WIDTH)
1563      Various forms of syntactic sugar.
1564
1565  -- Method on location: void step ()
1566      Move `begin' onto `end'.
1567
1568  -- Method on location: bool operator== (const location& THAT)
1569  -- Method on location: bool operator!= (const location& THAT)
1570      Whether `*this' and `that' denote equal/different ranges of
1571      positions.
1572
1573  -- Function: std::ostream& operator<< (std::ostream& O, const
1574           location& P)
1575      Report P on O, taking care of special cases such as: no `filename'
1576      defined, or equal filename/line or column.
1577
1578 \1f
1579 File: bison.info,  Node: C++ Parser Interface,  Next: C++ Scanner Interface,  Prev: C++ Location Values,  Up: C++ Parsers
1580
1581 10.1.4 C++ Parser Interface
1582 ---------------------------
1583
1584 The output files `OUTPUT.hh' and `OUTPUT.cc' declare and define the
1585 parser class in the namespace `yy'.  The class name defaults to
1586 `parser', but may be changed using `%define parser_class_name "NAME"'.
1587 The interface of this class is detailed below.  It can be extended
1588 using the `%parse-param' feature: its semantics is slightly changed
1589 since it describes an additional member of the parser class, and an
1590 additional argument for its constructor.
1591
1592  -- Type of parser: semantic_type
1593  -- Type of parser: location_type
1594      The types for semantics value and locations.
1595
1596  -- Type of parser: token
1597      A structure that contains (only) the `yytokentype' enumeration,
1598      which defines the tokens.  To refer to the token `FOO', use
1599      `yy::parser::token::FOO'.  The scanner can use `typedef
1600      yy::parser::token token;' to "import" the token enumeration (*note
1601      Calc++ Scanner::).
1602
1603  -- Method on parser:  parser (TYPE1 ARG1, ...)
1604      Build a new parser object.  There are no arguments by default,
1605      unless `%parse-param {TYPE1 ARG1}' was used.
1606
1607  -- Method on parser: int parse ()
1608      Run the syntactic analysis, and return 0 on success, 1 otherwise.
1609
1610  -- Method on parser: std::ostream& debug_stream ()
1611  -- Method on parser: void set_debug_stream (std::ostream& O)
1612      Get or set the stream used for tracing the parsing.  It defaults to
1613      `std::cerr'.
1614
1615  -- Method on parser: debug_level_type debug_level ()
1616  -- Method on parser: void set_debug_level (debug_level L)
1617      Get or set the tracing level.  Currently its value is either 0, no
1618      trace, or nonzero, full tracing.
1619
1620  -- Method on parser: void error (const location_type& L, const
1621           std::string& M)
1622      The definition for this member function must be supplied by the
1623      user: the parser uses it to report a parser error occurring at L,
1624      described by M.
1625
1626 \1f
1627 File: bison.info,  Node: C++ Scanner Interface,  Next: A Complete C++ Example,  Prev: C++ Parser Interface,  Up: C++ Parsers
1628
1629 10.1.5 C++ Scanner Interface
1630 ----------------------------
1631
1632 The parser invokes the scanner by calling `yylex'.  Contrary to C
1633 parsers, C++ parsers are always pure: there is no point in using the
1634 `%define api.pure' directive.  Therefore the interface is as follows.
1635
1636  -- Method on parser: int yylex (semantic_type* YYLVAL, location_type*
1637           YYLLOC, TYPE1 ARG1, ...)
1638      Return the next token.  Its type is the return value, its semantic
1639      value and location being YYLVAL and YYLLOC.  Invocations of
1640      `%lex-param {TYPE1 ARG1}' yield additional arguments.
1641
1642 \1f
1643 File: bison.info,  Node: A Complete C++ Example,  Prev: C++ Scanner Interface,  Up: C++ Parsers
1644
1645 10.1.6 A Complete C++ Example
1646 -----------------------------
1647
1648 This section demonstrates the use of a C++ parser with a simple but
1649 complete example.  This example should be available on your system,
1650 ready to compile, in the directory "../bison/examples/calc++".  It
1651 focuses on the use of Bison, therefore the design of the various C++
1652 classes is very naive: no accessors, no encapsulation of members etc.
1653 We will use a Lex scanner, and more precisely, a Flex scanner, to
1654 demonstrate the various interaction.  A hand written scanner is
1655 actually easier to interface with.
1656
1657 * Menu:
1658
1659 * Calc++ --- C++ Calculator::   The specifications
1660 * Calc++ Parsing Driver::       An active parsing context
1661 * Calc++ Parser::               A parser class
1662 * Calc++ Scanner::              A pure C++ Flex scanner
1663 * Calc++ Top Level::            Conducting the band
1664
1665 \1f
1666 File: bison.info,  Node: Calc++ --- C++ Calculator,  Next: Calc++ Parsing Driver,  Up: A Complete C++ Example
1667
1668 10.1.6.1 Calc++ -- C++ Calculator
1669 .................................
1670
1671 Of course the grammar is dedicated to arithmetics, a single expression,
1672 possibly preceded by variable assignments.  An environment containing
1673 possibly predefined variables such as `one' and `two', is exchanged
1674 with the parser.  An example of valid input follows.
1675
1676      three := 3
1677      seven := one + two * three
1678      seven * seven
1679
1680 \1f
1681 File: bison.info,  Node: Calc++ Parsing Driver,  Next: Calc++ Parser,  Prev: Calc++ --- C++ Calculator,  Up: A Complete C++ Example
1682
1683 10.1.6.2 Calc++ Parsing Driver
1684 ..............................
1685
1686 To support a pure interface with the parser (and the scanner) the
1687 technique of the "parsing context" is convenient: a structure
1688 containing all the data to exchange.  Since, in addition to simply
1689 launch the parsing, there are several auxiliary tasks to execute (open
1690 the file for parsing, instantiate the parser etc.), we recommend
1691 transforming the simple parsing context structure into a fully blown
1692 "parsing driver" class.
1693
1694    The declaration of this driver class, `calc++-driver.hh', is as
1695 follows.  The first part includes the CPP guard and imports the
1696 required standard library components, and the declaration of the parser
1697 class.
1698
1699      #ifndef CALCXX_DRIVER_HH
1700      # define CALCXX_DRIVER_HH
1701      # include <string>
1702      # include <map>
1703      # include "calc++-parser.hh"
1704
1705 Then comes the declaration of the scanning function.  Flex expects the
1706 signature of `yylex' to be defined in the macro `YY_DECL', and the C++
1707 parser expects it to be declared.  We can factor both as follows.
1708
1709      // Tell Flex the lexer's prototype ...
1710      # define YY_DECL                                        \
1711        yy::calcxx_parser::token_type                         \
1712        yylex (yy::calcxx_parser::semantic_type* yylval,      \
1713               yy::calcxx_parser::location_type* yylloc,      \
1714               calcxx_driver& driver)
1715      // ... and declare it for the parser's sake.
1716      YY_DECL;
1717
1718 The `calcxx_driver' class is then declared with its most obvious
1719 members.
1720
1721      // Conducting the whole scanning and parsing of Calc++.
1722      class calcxx_driver
1723      {
1724      public:
1725        calcxx_driver ();
1726        virtual ~calcxx_driver ();
1727
1728        std::map<std::string, int> variables;
1729
1730        int result;
1731
1732 To encapsulate the coordination with the Flex scanner, it is useful to
1733 have two members function to open and close the scanning phase.
1734
1735        // Handling the scanner.
1736        void scan_begin ();
1737        void scan_end ();
1738        bool trace_scanning;
1739
1740 Similarly for the parser itself.
1741
1742        // Run the parser.  Return 0 on success.
1743        int parse (const std::string& f);
1744        std::string file;
1745        bool trace_parsing;
1746
1747 To demonstrate pure handling of parse errors, instead of simply dumping
1748 them on the standard error output, we will pass them to the compiler
1749 driver using the following two member functions.  Finally, we close the
1750 class declaration and CPP guard.
1751
1752        // Error handling.
1753        void error (const yy::location& l, const std::string& m);
1754        void error (const std::string& m);
1755      };
1756      #endif // ! CALCXX_DRIVER_HH
1757
1758    The implementation of the driver is straightforward.  The `parse'
1759 member function deserves some attention.  The `error' functions are
1760 simple stubs, they should actually register the located error messages
1761 and set error state.
1762
1763      #include "calc++-driver.hh"
1764      #include "calc++-parser.hh"
1765
1766      calcxx_driver::calcxx_driver ()
1767        : trace_scanning (false), trace_parsing (false)
1768      {
1769        variables["one"] = 1;
1770        variables["two"] = 2;
1771      }
1772
1773      calcxx_driver::~calcxx_driver ()
1774      {
1775      }
1776
1777      int
1778      calcxx_driver::parse (const std::string &f)
1779      {
1780        file = f;
1781        scan_begin ();
1782        yy::calcxx_parser parser (*this);
1783        parser.set_debug_level (trace_parsing);
1784        int res = parser.parse ();
1785        scan_end ();
1786        return res;
1787      }
1788
1789      void
1790      calcxx_driver::error (const yy::location& l, const std::string& m)
1791      {
1792        std::cerr << l << ": " << m << std::endl;
1793      }
1794
1795      void
1796      calcxx_driver::error (const std::string& m)
1797      {
1798        std::cerr << m << std::endl;
1799      }
1800
1801 \1f
1802 File: bison.info,  Node: Calc++ Parser,  Next: Calc++ Scanner,  Prev: Calc++ Parsing Driver,  Up: A Complete C++ Example
1803
1804 10.1.6.3 Calc++ Parser
1805 ......................
1806
1807 The grammar file `calc++-parser.yy' starts by asking for the C++
1808 deterministic parser skeleton, the creation of the parser header file,
1809 and specifies the name of the parser class.  Because the C++ skeleton
1810 changed several times, it is safer to require the version you designed
1811 the grammar for.
1812
1813      %skeleton "lalr1.cc" /* -*- C++ -*- */
1814      %require "2.6.1-dirty"
1815      %defines
1816      %define parser_class_name "calcxx_parser"
1817
1818 Then come the declarations/inclusions needed to define the `%union'.
1819 Because the parser uses the parsing driver and reciprocally, both
1820 cannot include the header of the other.  Because the driver's header
1821 needs detailed knowledge about the parser class (in particular its
1822 inner types), it is the parser's header which will simply use a forward
1823 declaration of the driver.  *Note %code Summary::.
1824
1825      %code requires {
1826      # include <string>
1827      class calcxx_driver;
1828      }
1829
1830 The driver is passed by reference to the parser and to the scanner.
1831 This provides a simple but effective pure interface, not relying on
1832 global variables.
1833
1834      // The parsing context.
1835      %parse-param { calcxx_driver& driver }
1836      %lex-param   { calcxx_driver& driver }
1837
1838 Then we request the location tracking feature, and initialize the first
1839 location's file name.  Afterward new locations are computed relatively
1840 to the previous locations: the file name will be automatically
1841 propagated.
1842
1843      %locations
1844      %initial-action
1845      {
1846        // Initialize the initial location.
1847        @$.begin.filename = @$.end.filename = &driver.file;
1848      };
1849
1850 Use the two following directives to enable parser tracing and verbose
1851 error messages.  However, verbose error messages can contain incorrect
1852 information (*note LAC::).
1853
1854      %debug
1855      %error-verbose
1856
1857 Semantic values cannot use "real" objects, but only pointers to them.
1858
1859      // Symbols.
1860      %union
1861      {
1862        int          ival;
1863        std::string *sval;
1864      };
1865
1866 The code between `%code {' and `}' is output in the `*.cc' file; it
1867 needs detailed knowledge about the driver.
1868
1869      %code {
1870      # include "calc++-driver.hh"
1871      }
1872
1873 The token numbered as 0 corresponds to end of file; the following line
1874 allows for nicer error messages referring to "end of file" instead of
1875 "$end".  Similarly user friendly named are provided for each symbol.
1876 Note that the tokens names are prefixed by `TOKEN_' to avoid name
1877 clashes.
1878
1879      %token        END      0 "end of file"
1880      %token        ASSIGN     ":="
1881      %token <sval> IDENTIFIER "identifier"
1882      %token <ival> NUMBER     "number"
1883      %type  <ival> exp
1884
1885 To enable memory deallocation during error recovery, use `%destructor'.
1886
1887      %printer    { yyoutput << *$$; } "identifier"
1888      %destructor { delete $$; } "identifier"
1889
1890      %printer    { yyoutput << $$; } <ival>
1891
1892 The grammar itself is straightforward.
1893
1894      %%
1895      %start unit;
1896      unit: assignments exp  { driver.result = $2; };
1897
1898      assignments:
1899        /* Nothing.  */        {}
1900      | assignments assignment {};
1901
1902      assignment:
1903           "identifier" ":=" exp
1904             { driver.variables[*$1] = $3; delete $1; };
1905
1906      %left '+' '-';
1907      %left '*' '/';
1908      exp: exp '+' exp   { $$ = $1 + $3; }
1909         | exp '-' exp   { $$ = $1 - $3; }
1910         | exp '*' exp   { $$ = $1 * $3; }
1911         | exp '/' exp   { $$ = $1 / $3; }
1912         | "identifier"  { $$ = driver.variables[*$1]; delete $1; }
1913         | "number"      { $$ = $1; };
1914      %%
1915
1916 Finally the `error' member function registers the errors to the driver.
1917
1918      void
1919      yy::calcxx_parser::error (const yy::calcxx_parser::location_type& l,
1920                                const std::string& m)
1921      {
1922        driver.error (l, m);
1923      }
1924
1925 \1f
1926 File: bison.info,  Node: Calc++ Scanner,  Next: Calc++ Top Level,  Prev: Calc++ Parser,  Up: A Complete C++ Example
1927
1928 10.1.6.4 Calc++ Scanner
1929 .......................
1930
1931 The Flex scanner first includes the driver declaration, then the
1932 parser's to get the set of defined tokens.
1933
1934      %{ /* -*- C++ -*- */
1935      # include <cstdlib>
1936      # include <cerrno>
1937      # include <climits>
1938      # include <string>
1939      # include "calc++-driver.hh"
1940      # include "calc++-parser.hh"
1941
1942      /* Work around an incompatibility in flex (at least versions
1943         2.5.31 through 2.5.33): it generates code that does
1944         not conform to C89.  See Debian bug 333231
1945         <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>.  */
1946      # undef yywrap
1947      # define yywrap() 1
1948
1949      /* By default yylex returns int, we use token_type.
1950         Unfortunately yyterminate by default returns 0, which is
1951         not of token_type.  */
1952      #define yyterminate() return token::END
1953      %}
1954
1955 Because there is no `#include'-like feature we don't need `yywrap', we
1956 don't need `unput' either, and we parse an actual file, this is not an
1957 interactive session with the user.  Finally we enable the scanner
1958 tracing features.
1959
1960      %option noyywrap nounput batch debug
1961
1962 Abbreviations allow for more readable rules.
1963
1964      id    [a-zA-Z][a-zA-Z_0-9]*
1965      int   [0-9]+
1966      blank [ \t]
1967
1968 The following paragraph suffices to track locations accurately.  Each
1969 time `yylex' is invoked, the begin position is moved onto the end
1970 position.  Then when a pattern is matched, the end position is advanced
1971 of its width.  In case it matched ends of lines, the end cursor is
1972 adjusted, and each time blanks are matched, the begin cursor is moved
1973 onto the end cursor to effectively ignore the blanks preceding tokens.
1974 Comments would be treated equally.
1975
1976      %{
1977      # define YY_USER_ACTION  yylloc->columns (yyleng);
1978      %}
1979      %%
1980      %{
1981        yylloc->step ();
1982      %}
1983      {blank}+   yylloc->step ();
1984      [\n]+      yylloc->lines (yyleng); yylloc->step ();
1985
1986 The rules are simple, just note the use of the driver to report errors.
1987 It is convenient to use a typedef to shorten
1988 `yy::calcxx_parser::token::identifier' into `token::identifier' for
1989 instance.
1990
1991      %{
1992        typedef yy::calcxx_parser::token token;
1993      %}
1994                 /* Convert ints to the actual type of tokens.  */
1995      [-+*/]     return yy::calcxx_parser::token_type (yytext[0]);
1996      ":="       return token::ASSIGN;
1997      {int}      {
1998        errno = 0;
1999        long n = strtol (yytext, NULL, 10);
2000        if (! (INT_MIN <= n && n <= INT_MAX && errno != ERANGE))
2001          driver.error (*yylloc, "integer is out of range");
2002        yylval->ival = n;
2003        return token::NUMBER;
2004      }
2005      {id}       yylval->sval = new std::string (yytext); return token::IDENTIFIER;
2006      .          driver.error (*yylloc, "invalid character");
2007      %%
2008
2009 Finally, because the scanner related driver's member function depend on
2010 the scanner's data, it is simpler to implement them in this file.
2011
2012      void
2013      calcxx_driver::scan_begin ()
2014      {
2015        yy_flex_debug = trace_scanning;
2016        if (file.empty () || file == "-")
2017          yyin = stdin;
2018        else if (!(yyin = fopen (file.c_str (), "r")))
2019          {
2020            error ("cannot open " + file + ": " + strerror(errno));
2021            exit (EXIT_FAILURE);
2022          }
2023      }
2024
2025      void
2026      calcxx_driver::scan_end ()
2027      {
2028        fclose (yyin);
2029      }
2030
2031 \1f
2032 File: bison.info,  Node: Calc++ Top Level,  Prev: Calc++ Scanner,  Up: A Complete C++ Example
2033
2034 10.1.6.5 Calc++ Top Level
2035 .........................
2036
2037 The top level file, `calc++.cc', poses no problem.
2038
2039      #include <iostream>
2040      #include "calc++-driver.hh"
2041
2042      int
2043      main (int argc, char *argv[])
2044      {
2045        calcxx_driver driver;
2046        for (int i = 1; i < argc; ++i)
2047          if (argv[i] == std::string ("-p"))
2048            driver.trace_parsing = true;
2049          else if (argv[i] == std::string ("-s"))
2050            driver.trace_scanning = true;
2051          else if (!driver.parse (argv[i]))
2052            std::cout << driver.result << std::endl;
2053      }
2054
2055 \1f
2056 File: bison.info,  Node: Java Parsers,  Prev: C++ Parsers,  Up: Other Languages
2057
2058 10.2 Java Parsers
2059 =================
2060
2061 * Menu:
2062
2063 * Java Bison Interface::        Asking for Java parser generation
2064 * Java Semantic Values::        %type and %token vs. Java
2065 * Java Location Values::        The position and location classes
2066 * Java Parser Interface::       Instantiating and running the parser
2067 * Java Scanner Interface::      Specifying the scanner for the parser
2068 * Java Action Features::        Special features for use in actions
2069 * Java Differences::            Differences between C/C++ and Java Grammars
2070 * Java Declarations Summary::   List of Bison declarations used with Java
2071
2072 \1f
2073 File: bison.info,  Node: Java Bison Interface,  Next: Java Semantic Values,  Up: Java Parsers
2074
2075 10.2.1 Java Bison Interface
2076 ---------------------------
2077
2078 (The current Java interface is experimental and may evolve.  More user
2079 feedback will help to stabilize it.)
2080
2081    The Java parser skeletons are selected using the `%language "Java"'
2082 directive or the `-L java'/`--language=java' option.
2083
2084    When generating a Java parser, `bison BASENAME.y' will create a
2085 single Java source file named `BASENAME.java' containing the parser
2086 implementation.  Using a grammar file without a `.y' suffix is
2087 currently broken.  The basename of the parser implementation file can
2088 be changed by the `%file-prefix' directive or the `-p'/`--name-prefix'
2089 option.  The entire parser implementation file name can be changed by
2090 the `%output' directive or the `-o'/`--output' option.  The parser
2091 implementation file contains a single class for the parser.
2092
2093    You can create documentation for generated parsers using Javadoc.
2094
2095    Contrary to C parsers, Java parsers do not use global variables; the
2096 state of the parser is always local to an instance of the parser class.
2097 Therefore, all Java parsers are "pure", and the `%pure-parser' and
2098 `%define api.pure' directives does not do anything when used in Java.
2099
2100    Push parsers are currently unsupported in Java and `%define
2101 api.push-pull' have no effect.
2102
2103    GLR parsers are currently unsupported in Java.  Do not use the
2104 `glr-parser' directive.
2105
2106    No header file can be generated for Java parsers.  Do not use the
2107 `%defines' directive or the `-d'/`--defines' options.
2108
2109    Currently, support for debugging and verbose errors are always
2110 compiled in.  Thus the `%debug' and `%token-table' directives and the
2111 `-t'/`--debug' and `-k'/`--token-table' options have no effect.  This
2112 may change in the future to eliminate unused code in the generated
2113 parser, so use `%debug' and `%verbose-error' explicitly if needed.
2114 Also, in the future the `%token-table' directive might enable a public
2115 interface to access the token names and codes.
2116
2117 \1f
2118 File: bison.info,  Node: Java Semantic Values,  Next: Java Location Values,  Prev: Java Bison Interface,  Up: Java Parsers
2119
2120 10.2.2 Java Semantic Values
2121 ---------------------------
2122
2123 There is no `%union' directive in Java parsers.  Instead, the semantic
2124 values' types (class names) should be specified in the `%type' or
2125 `%token' directive:
2126
2127      %type <Expression> expr assignment_expr term factor
2128      %type <Integer> number
2129
2130    By default, the semantic stack is declared to have `Object' members,
2131 which means that the class types you specify can be of any class.  To
2132 improve the type safety of the parser, you can declare the common
2133 superclass of all the semantic values using the `%define stype'
2134 directive.  For example, after the following declaration:
2135
2136      %define stype "ASTNode"
2137
2138 any `%type' or `%token' specifying a semantic type which is not a
2139 subclass of ASTNode, will cause a compile-time error.
2140
2141    Types used in the directives may be qualified with a package name.
2142 Primitive data types are accepted for Java version 1.5 or later.  Note
2143 that in this case the autoboxing feature of Java 1.5 will be used.
2144 Generic types may not be used; this is due to a limitation in the
2145 implementation of Bison, and may change in future releases.
2146
2147    Java parsers do not support `%destructor', since the language adopts
2148 garbage collection.  The parser will try to hold references to semantic
2149 values for as little time as needed.
2150
2151    Java parsers do not support `%printer', as `toString()' can be used
2152 to print the semantic values.  This however may change (in a
2153 backwards-compatible way) in future versions of Bison.
2154
2155 \1f
2156 File: bison.info,  Node: Java Location Values,  Next: Java Parser Interface,  Prev: Java Semantic Values,  Up: Java Parsers
2157
2158 10.2.3 Java Location Values
2159 ---------------------------
2160
2161 When the directive `%locations' is used, the Java parser supports
2162 location tracking, see *note Tracking Locations::.  An auxiliary
2163 user-defined class defines a "position", a single point in a file;
2164 Bison itself defines a class representing a "location", a range
2165 composed of a pair of positions (possibly spanning several files).  The
2166 location class is an inner class of the parser; the name is `Location'
2167 by default, and may also be renamed using `%define location_type
2168 "CLASS-NAME"'.
2169
2170    The location class treats the position as a completely opaque value.
2171 By default, the class name is `Position', but this can be changed with
2172 `%define position_type "CLASS-NAME"'.  This class must be supplied by
2173 the user.
2174
2175  -- Instance Variable of Location: Position begin
2176  -- Instance Variable of Location: Position end
2177      The first, inclusive, position of the range, and the first beyond.
2178
2179  -- Constructor on Location:  Location (Position LOC)
2180      Create a `Location' denoting an empty range located at a given
2181      point.
2182
2183  -- Constructor on Location:  Location (Position BEGIN, Position END)
2184      Create a `Location' from the endpoints of the range.
2185
2186  -- Method on Location: String toString ()
2187      Prints the range represented by the location.  For this to work
2188      properly, the position class should override the `equals' and
2189      `toString' methods appropriately.
2190
2191 \1f
2192 File: bison.info,  Node: Java Parser Interface,  Next: Java Scanner Interface,  Prev: Java Location Values,  Up: Java Parsers
2193
2194 10.2.4 Java Parser Interface
2195 ----------------------------
2196
2197 The name of the generated parser class defaults to `YYParser'.  The
2198 `YY' prefix may be changed using the `%name-prefix' directive or the
2199 `-p'/`--name-prefix' option.  Alternatively, use `%define
2200 parser_class_name "NAME"' to give a custom name to the class.  The
2201 interface of this class is detailed below.
2202
2203    By default, the parser class has package visibility.  A declaration
2204 `%define public' will change to public visibility.  Remember that,
2205 according to the Java language specification, the name of the `.java'
2206 file should match the name of the class in this case.  Similarly, you
2207 can use `abstract', `final' and `strictfp' with the `%define'
2208 declaration to add other modifiers to the parser class.
2209
2210    The Java package name of the parser class can be specified using the
2211 `%define package' directive.  The superclass and the implemented
2212 interfaces of the parser class can be specified with the `%define
2213 extends' and `%define implements' directives.
2214
2215    The parser class defines an inner class, `Location', that is used
2216 for location tracking (see *note Java Location Values::), and a inner
2217 interface, `Lexer' (see *note Java Scanner Interface::).  Other than
2218 these inner class/interface, and the members described in the interface
2219 below, all the other members and fields are preceded with a `yy' or
2220 `YY' prefix to avoid clashes with user code.
2221
2222    The parser class can be extended using the `%parse-param' directive.
2223 Each occurrence of the directive will add a `protected final' field to
2224 the parser class, and an argument to its constructor, which initialize
2225 them automatically.
2226
2227    Token names defined by `%token' and the predefined `EOF' token name
2228 are added as constant fields to the parser class.
2229
2230  -- Constructor on YYParser:  YYParser (LEX_PARAM, ..., PARSE_PARAM,
2231           ...)
2232      Build a new parser object with embedded `%code lexer'.  There are
2233      no parameters, unless `%parse-param's and/or `%lex-param's are
2234      used.
2235
2236  -- Constructor on YYParser:  YYParser (Lexer LEXER, PARSE_PARAM, ...)
2237      Build a new parser object using the specified scanner.  There are
2238      no additional parameters unless `%parse-param's are used.
2239
2240      If the scanner is defined by `%code lexer', this constructor is
2241      declared `protected' and is called automatically with a scanner
2242      created with the correct `%lex-param's.
2243
2244  -- Method on YYParser: boolean parse ()
2245      Run the syntactic analysis, and return `true' on success, `false'
2246      otherwise.
2247
2248  -- Method on YYParser: boolean recovering ()
2249      During the syntactic analysis, return `true' if recovering from a
2250      syntax error.  *Note Error Recovery::.
2251
2252  -- Method on YYParser: java.io.PrintStream getDebugStream ()
2253  -- Method on YYParser: void setDebugStream (java.io.printStream O)
2254      Get or set the stream used for tracing the parsing.  It defaults to
2255      `System.err'.
2256
2257  -- Method on YYParser: int getDebugLevel ()
2258  -- Method on YYParser: void setDebugLevel (int L)
2259      Get or set the tracing level.  Currently its value is either 0, no
2260      trace, or nonzero, full tracing.
2261
2262 \1f
2263 File: bison.info,  Node: Java Scanner Interface,  Next: Java Action Features,  Prev: Java Parser Interface,  Up: Java Parsers
2264
2265 10.2.5 Java Scanner Interface
2266 -----------------------------
2267
2268 There are two possible ways to interface a Bison-generated Java parser
2269 with a scanner: the scanner may be defined by `%code lexer', or defined
2270 elsewhere.  In either case, the scanner has to implement the `Lexer'
2271 inner interface of the parser class.
2272
2273    In the first case, the body of the scanner class is placed in `%code
2274 lexer' blocks.  If you want to pass parameters from the parser
2275 constructor to the scanner constructor, specify them with `%lex-param';
2276 they are passed before `%parse-param's to the constructor.
2277
2278    In the second case, the scanner has to implement the `Lexer'
2279 interface, which is defined within the parser class (e.g.,
2280 `YYParser.Lexer').  The constructor of the parser object will then
2281 accept an object implementing the interface; `%lex-param' is not used
2282 in this case.
2283
2284    In both cases, the scanner has to implement the following methods.
2285
2286  -- Method on Lexer: void yyerror (Location LOC, String MSG)
2287      This method is defined by the user to emit an error message.  The
2288      first parameter is omitted if location tracking is not active.
2289      Its type can be changed using `%define location_type "CLASS-NAME".'
2290
2291  -- Method on Lexer: int yylex ()
2292      Return the next token.  Its type is the return value, its semantic
2293      value and location are saved and returned by the their methods in
2294      the interface.
2295
2296      Use `%define lex_throws' to specify any uncaught exceptions.
2297      Default is `java.io.IOException'.
2298
2299  -- Method on Lexer: Position getStartPos ()
2300  -- Method on Lexer: Position getEndPos ()
2301      Return respectively the first position of the last token that
2302      `yylex' returned, and the first position beyond it.  These methods
2303      are not needed unless location tracking is active.
2304
2305      The return type can be changed using `%define position_type
2306      "CLASS-NAME".'
2307
2308  -- Method on Lexer: Object getLVal ()
2309      Return the semantic value of the last token that yylex returned.
2310
2311      The return type can be changed using `%define stype "CLASS-NAME".'
2312
2313 \1f
2314 File: bison.info,  Node: Java Action Features,  Next: Java Differences,  Prev: Java Scanner Interface,  Up: Java Parsers
2315
2316 10.2.6 Special Features for Use in Java Actions
2317 -----------------------------------------------
2318
2319 The following special constructs can be uses in Java actions.  Other
2320 analogous C action features are currently unavailable for Java.
2321
2322    Use `%define throws' to specify any uncaught exceptions from parser
2323 actions, and initial actions specified by `%initial-action'.
2324
2325  -- Variable: $N
2326      The semantic value for the Nth component of the current rule.
2327      This may not be assigned to.  *Note Java Semantic Values::.
2328
2329  -- Variable: $<TYPEALT>N
2330      Like `$N' but specifies a alternative type TYPEALT.  *Note Java
2331      Semantic Values::.
2332
2333  -- Variable: $$
2334      The semantic value for the grouping made by the current rule.  As a
2335      value, this is in the base type (`Object' or as specified by
2336      `%define stype') as in not cast to the declared subtype because
2337      casts are not allowed on the left-hand side of Java assignments.
2338      Use an explicit Java cast if the correct subtype is needed.  *Note
2339      Java Semantic Values::.
2340
2341  -- Variable: $<TYPEALT>$
2342      Same as `$$' since Java always allow assigning to the base type.
2343      Perhaps we should use this and `$<>$' for the value and `$$' for
2344      setting the value but there is currently no easy way to distinguish
2345      these constructs.  *Note Java Semantic Values::.
2346
2347  -- Variable: @N
2348      The location information of the Nth component of the current rule.
2349      This may not be assigned to.  *Note Java Location Values::.
2350
2351  -- Variable: @$
2352      The location information of the grouping made by the current rule.
2353      *Note Java Location Values::.
2354
2355  -- Statement: return YYABORT `;'
2356      Return immediately from the parser, indicating failure.  *Note
2357      Java Parser Interface::.
2358
2359  -- Statement: return YYACCEPT `;'
2360      Return immediately from the parser, indicating success.  *Note
2361      Java Parser Interface::.
2362
2363  -- Statement: return YYERROR `;'
2364      Start error recovery (without printing an error message).  *Note
2365      Error Recovery::.
2366
2367  -- Function: boolean recovering ()
2368      Return whether error recovery is being done. In this state, the
2369      parser reads token until it reaches a known state, and then
2370      restarts normal operation.  *Note Error Recovery::.
2371
2372  -- Function: protected void yyerror (String msg)
2373  -- Function: protected void yyerror (Position pos, String msg)
2374  -- Function: protected void yyerror (Location loc, String msg)
2375      Print an error message using the `yyerror' method of the scanner
2376      instance in use.
2377
2378 \1f
2379 File: bison.info,  Node: Java Differences,  Next: Java Declarations Summary,  Prev: Java Action Features,  Up: Java Parsers
2380
2381 10.2.7 Differences between C/C++ and Java Grammars
2382 --------------------------------------------------
2383
2384 The different structure of the Java language forces several differences
2385 between C/C++ grammars, and grammars designed for Java parsers.  This
2386 section summarizes these differences.
2387
2388    * Java lacks a preprocessor, so the `YYERROR', `YYACCEPT', `YYABORT'
2389      symbols (*note Table of Symbols::) cannot obviously be macros.
2390      Instead, they should be preceded by `return' when they appear in
2391      an action.  The actual definition of these symbols is opaque to
2392      the Bison grammar, and it might change in the future.  The only
2393      meaningful operation that you can do, is to return them.  *Note
2394      Java Action Features::.
2395
2396      Note that of these three symbols, only `YYACCEPT' and `YYABORT'
2397      will cause a return from the `yyparse' method(1).
2398
2399    * Java lacks unions, so `%union' has no effect.  Instead, semantic
2400      values have a common base type: `Object' or as specified by
2401      `%define stype'.  Angle brackets on `%token', `type', `$N' and
2402      `$$' specify subtypes rather than fields of an union.  The type of
2403      `$$', even with angle brackets, is the base type since Java casts
2404      are not allow on the left-hand side of assignments.  Also, `$N'
2405      and `@N' are not allowed on the left-hand side of assignments.
2406      *Note Java Semantic Values::, and *note Java Action Features::.
2407
2408    * The prologue declarations have a different meaning than in C/C++
2409      code.
2410     `%code imports'
2411           blocks are placed at the beginning of the Java source code.
2412           They may include copyright notices.  For a `package'
2413           declarations, it is suggested to use `%define package'
2414           instead.
2415
2416     unqualified `%code'
2417           blocks are placed inside the parser class.
2418
2419     `%code lexer'
2420           blocks, if specified, should include the implementation of the
2421           scanner.  If there is no such block, the scanner can be any
2422           class that implements the appropriate interface (*note Java
2423           Scanner Interface::).
2424
2425      Other `%code' blocks are not supported in Java parsers.  In
2426      particular, `%{ ... %}' blocks should not be used and may give an
2427      error in future versions of Bison.
2428
2429      The epilogue has the same meaning as in C/C++ code and it can be
2430      used to define other classes used by the parser _outside_ the
2431      parser class.
2432
2433    ---------- Footnotes ----------
2434
2435    (1) Java parsers include the actions in a separate method than
2436 `yyparse' in order to have an intuitive syntax that corresponds to
2437 these C macros.
2438
2439 \1f
2440 File: bison.info,  Node: Java Declarations Summary,  Prev: Java Differences,  Up: Java Parsers
2441
2442 10.2.8 Java Declarations Summary
2443 --------------------------------
2444
2445 This summary only include declarations specific to Java or have special
2446 meaning when used in a Java parser.
2447
2448  -- Directive: %language "Java"
2449      Generate a Java class for the parser.
2450
2451  -- Directive: %lex-param {TYPE NAME}
2452      A parameter for the lexer class defined by `%code lexer' _only_,
2453      added as parameters to the lexer constructor and the parser
2454      constructor that _creates_ a lexer.  Default is none.  *Note Java
2455      Scanner Interface::.
2456
2457  -- Directive: %name-prefix "PREFIX"
2458      The prefix of the parser class name `PREFIXParser' if `%define
2459      parser_class_name' is not used.  Default is `YY'.  *Note Java
2460      Bison Interface::.
2461
2462  -- Directive: %parse-param {TYPE NAME}
2463      A parameter for the parser class added as parameters to
2464      constructor(s) and as fields initialized by the constructor(s).
2465      Default is none.  *Note Java Parser Interface::.
2466
2467  -- Directive: %token <TYPE> TOKEN ...
2468      Declare tokens.  Note that the angle brackets enclose a Java
2469      _type_.  *Note Java Semantic Values::.
2470
2471  -- Directive: %type <TYPE> NONTERMINAL ...
2472      Declare the type of nonterminals.  Note that the angle brackets
2473      enclose a Java _type_.  *Note Java Semantic Values::.
2474
2475  -- Directive: %code { CODE ... }
2476      Code appended to the inside of the parser class.  *Note Java
2477      Differences::.
2478
2479  -- Directive: %code imports { CODE ... }
2480      Code inserted just after the `package' declaration.  *Note Java
2481      Differences::.
2482
2483  -- Directive: %code lexer { CODE ... }
2484      Code added to the body of a inner lexer class within the parser
2485      class.  *Note Java Scanner Interface::.
2486
2487  -- Directive: %% CODE ...
2488      Code (after the second `%%') appended to the end of the file,
2489      _outside_ the parser class.  *Note Java Differences::.
2490
2491  -- Directive: %{ CODE ... %}
2492      Not supported.  Use `%code import' instead.  *Note Java
2493      Differences::.
2494
2495  -- Directive: %define abstract
2496      Whether the parser class is declared `abstract'.  Default is false.
2497      *Note Java Bison Interface::.
2498
2499  -- Directive: %define extends "SUPERCLASS"
2500      The superclass of the parser class.  Default is none.  *Note Java
2501      Bison Interface::.
2502
2503  -- Directive: %define final
2504      Whether the parser class is declared `final'.  Default is false.
2505      *Note Java Bison Interface::.
2506
2507  -- Directive: %define implements "INTERFACES"
2508      The implemented interfaces of the parser class, a comma-separated
2509      list.  Default is none.  *Note Java Bison Interface::.
2510
2511  -- Directive: %define lex_throws "EXCEPTIONS"
2512      The exceptions thrown by the `yylex' method of the lexer, a
2513      comma-separated list.  Default is `java.io.IOException'.  *Note
2514      Java Scanner Interface::.
2515
2516  -- Directive: %define location_type "CLASS"
2517      The name of the class used for locations (a range between two
2518      positions).  This class is generated as an inner class of the
2519      parser class by `bison'.  Default is `Location'.  *Note Java
2520      Location Values::.
2521
2522  -- Directive: %define package "PACKAGE"
2523      The package to put the parser class in.  Default is none.  *Note
2524      Java Bison Interface::.
2525
2526  -- Directive: %define parser_class_name "NAME"
2527      The name of the parser class.  Default is `YYParser' or
2528      `NAME-PREFIXParser'.  *Note Java Bison Interface::.
2529
2530  -- Directive: %define position_type "CLASS"
2531      The name of the class used for positions. This class must be
2532      supplied by the user.  Default is `Position'.  *Note Java Location
2533      Values::.
2534
2535  -- Directive: %define public
2536      Whether the parser class is declared `public'.  Default is false.
2537      *Note Java Bison Interface::.
2538
2539  -- Directive: %define stype "CLASS"
2540      The base type of semantic values.  Default is `Object'.  *Note
2541      Java Semantic Values::.
2542
2543  -- Directive: %define strictfp
2544      Whether the parser class is declared `strictfp'.  Default is false.
2545      *Note Java Bison Interface::.
2546
2547  -- Directive: %define throws "EXCEPTIONS"
2548      The exceptions thrown by user-supplied parser actions and
2549      `%initial-action', a comma-separated list.  Default is none.
2550      *Note Java Parser Interface::.
2551
2552 \1f
2553 File: bison.info,  Node: FAQ,  Next: Table of Symbols,  Prev: Other Languages,  Up: Top
2554
2555 11 Frequently Asked Questions
2556 *****************************
2557
2558 Several questions about Bison come up occasionally.  Here some of them
2559 are addressed.
2560
2561 * Menu:
2562
2563 * Memory Exhausted::            Breaking the Stack Limits
2564 * How Can I Reset the Parser::  `yyparse' Keeps some State
2565 * Strings are Destroyed::       `yylval' Loses Track of Strings
2566 * Implementing Gotos/Loops::    Control Flow in the Calculator
2567 * Multiple start-symbols::      Factoring closely related grammars
2568 * Secure?  Conform?::           Is Bison POSIX safe?
2569 * I can't build Bison::         Troubleshooting
2570 * Where can I find help?::      Troubleshouting
2571 * Bug Reports::                 Troublereporting
2572 * More Languages::              Parsers in C++, Java, and so on
2573 * Beta Testing::                Experimenting development versions
2574 * Mailing Lists::               Meeting other Bison users
2575
2576 \1f
2577 File: bison.info,  Node: Memory Exhausted,  Next: How Can I Reset the Parser,  Up: FAQ
2578
2579 11.1 Memory Exhausted
2580 =====================
2581
2582      My parser returns with error with a `memory exhausted' message.
2583      What can I do?
2584
2585    This question is already addressed elsewhere, see *note Recursive
2586 Rules: Recursion.
2587
2588 \1f
2589 File: bison.info,  Node: How Can I Reset the Parser,  Next: Strings are Destroyed,  Prev: Memory Exhausted,  Up: FAQ
2590
2591 11.2 How Can I Reset the Parser
2592 ===============================
2593
2594 The following phenomenon has several symptoms, resulting in the
2595 following typical questions:
2596
2597      I invoke `yyparse' several times, and on correct input it works
2598      properly; but when a parse error is found, all the other calls fail
2599      too.  How can I reset the error flag of `yyparse'?
2600
2601 or
2602
2603      My parser includes support for an `#include'-like feature, in
2604      which case I run `yyparse' from `yyparse'.  This fails although I
2605      did specify `%define api.pure'.
2606
2607    These problems typically come not from Bison itself, but from
2608 Lex-generated scanners.  Because these scanners use large buffers for
2609 speed, they might not notice a change of input file.  As a
2610 demonstration, consider the following source file, `first-line.l':
2611
2612      %{
2613      #include <stdio.h>
2614      #include <stdlib.h>
2615      %}
2616      %%
2617      .*\n    ECHO; return 1;
2618      %%
2619      int
2620      yyparse (char const *file)
2621      {
2622        yyin = fopen (file, "r");
2623        if (!yyin)
2624          {
2625            perror ("fopen");
2626            exit (EXIT_FAILURE);
2627          }
2628        /* One token only.  */
2629        yylex ();
2630        if (fclose (yyin) != 0)
2631          {
2632            perror ("fclose");
2633            exit (EXIT_FAILURE);
2634          }
2635        return 0;
2636      }
2637
2638      int
2639      main (void)
2640      {
2641        yyparse ("input");
2642        yyparse ("input");
2643        return 0;
2644      }
2645
2646 If the file `input' contains
2647
2648      input:1: Hello,
2649      input:2: World!
2650
2651 then instead of getting the first line twice, you get:
2652
2653      $ flex -ofirst-line.c first-line.l
2654      $ gcc  -ofirst-line   first-line.c -ll
2655      $ ./first-line
2656      input:1: Hello,
2657      input:2: World!
2658
2659    Therefore, whenever you change `yyin', you must tell the
2660 Lex-generated scanner to discard its current buffer and switch to the
2661 new one.  This depends upon your implementation of Lex; see its
2662 documentation for more.  For Flex, it suffices to call
2663 `YY_FLUSH_BUFFER' after each change to `yyin'.  If your Flex-generated
2664 scanner needs to read from several input streams to handle features
2665 like include files, you might consider using Flex functions like
2666 `yy_switch_to_buffer' that manipulate multiple input buffers.
2667
2668    If your Flex-generated scanner uses start conditions (*note Start
2669 conditions: (flex)Start conditions.), you might also want to reset the
2670 scanner's state, i.e., go back to the initial start condition, through
2671 a call to `BEGIN (0)'.
2672
2673 \1f
2674 File: bison.info,  Node: Strings are Destroyed,  Next: Implementing Gotos/Loops,  Prev: How Can I Reset the Parser,  Up: FAQ
2675
2676 11.3 Strings are Destroyed
2677 ==========================
2678
2679      My parser seems to destroy old strings, or maybe it loses track of
2680      them.  Instead of reporting `"foo", "bar"', it reports `"bar",
2681      "bar"', or even `"foo\nbar", "bar"'.
2682
2683    This error is probably the single most frequent "bug report" sent to
2684 Bison lists, but is only concerned with a misunderstanding of the role
2685 of the scanner.  Consider the following Lex code:
2686
2687      %{
2688      #include <stdio.h>
2689      char *yylval = NULL;
2690      %}
2691      %%
2692      .*    yylval = yytext; return 1;
2693      \n    /* IGNORE */
2694      %%
2695      int
2696      main ()
2697      {
2698        /* Similar to using $1, $2 in a Bison action.  */
2699        char *fst = (yylex (), yylval);
2700        char *snd = (yylex (), yylval);
2701        printf ("\"%s\", \"%s\"\n", fst, snd);
2702        return 0;
2703      }
2704
2705    If you compile and run this code, you get:
2706
2707      $ flex -osplit-lines.c split-lines.l
2708      $ gcc  -osplit-lines   split-lines.c -ll
2709      $ printf 'one\ntwo\n' | ./split-lines
2710      "one
2711      two", "two"
2712
2713 this is because `yytext' is a buffer provided for _reading_ in the
2714 action, but if you want to keep it, you have to duplicate it (e.g.,
2715 using `strdup').  Note that the output may depend on how your
2716 implementation of Lex handles `yytext'.  For instance, when given the
2717 Lex compatibility option `-l' (which triggers the option `%array') Flex
2718 generates a different behavior:
2719
2720      $ flex -l -osplit-lines.c split-lines.l
2721      $ gcc     -osplit-lines   split-lines.c -ll
2722      $ printf 'one\ntwo\n' | ./split-lines
2723      "two", "two"
2724
2725 \1f
2726 File: bison.info,  Node: Implementing Gotos/Loops,  Next: Multiple start-symbols,  Prev: Strings are Destroyed,  Up: FAQ
2727
2728 11.4 Implementing Gotos/Loops
2729 =============================
2730
2731      My simple calculator supports variables, assignments, and
2732      functions, but how can I implement gotos, or loops?
2733
2734    Although very pedagogical, the examples included in the document blur
2735 the distinction to make between the parser--whose job is to recover the
2736 structure of a text and to transmit it to subsequent modules of the
2737 program--and the processing (such as the execution) of this structure.
2738 This works well with so called straight line programs, i.e., precisely
2739 those that have a straightforward execution model: execute simple
2740 instructions one after the others.
2741
2742    If you want a richer model, you will probably need to use the parser
2743 to construct a tree that does represent the structure it has recovered;
2744 this tree is usually called the "abstract syntax tree", or "AST" for
2745 short.  Then, walking through this tree, traversing it in various ways,
2746 will enable treatments such as its execution or its translation, which
2747 will result in an interpreter or a compiler.
2748
2749    This topic is way beyond the scope of this manual, and the reader is
2750 invited to consult the dedicated literature.
2751
2752 \1f
2753 File: bison.info,  Node: Multiple start-symbols,  Next: Secure? Conform?,  Prev: Implementing Gotos/Loops,  Up: FAQ
2754
2755 11.5 Multiple start-symbols
2756 ===========================
2757
2758      I have several closely related grammars, and I would like to share
2759      their implementations.  In fact, I could use a single grammar but
2760      with multiple entry points.
2761
2762    Bison does not support multiple start-symbols, but there is a very
2763 simple means to simulate them.  If `foo' and `bar' are the two pseudo
2764 start-symbols, then introduce two new tokens, say `START_FOO' and
2765 `START_BAR', and use them as switches from the real start-symbol:
2766
2767      %token START_FOO START_BAR;
2768      %start start;
2769      start:
2770        START_FOO foo
2771      | START_BAR bar;
2772
2773    These tokens prevents the introduction of new conflicts.  As far as
2774 the parser goes, that is all that is needed.
2775
2776    Now the difficult part is ensuring that the scanner will send these
2777 tokens first.  If your scanner is hand-written, that should be
2778 straightforward.  If your scanner is generated by Lex, them there is
2779 simple means to do it: recall that anything between `%{ ... %}' after
2780 the first `%%' is copied verbatim in the top of the generated `yylex'
2781 function.  Make sure a variable `start_token' is available in the
2782 scanner (e.g., a global variable or using `%lex-param' etc.), and use
2783 the following:
2784
2785        /* Prologue.  */
2786      %%
2787      %{
2788        if (start_token)
2789          {
2790            int t = start_token;
2791            start_token = 0;
2792            return t;
2793          }
2794      %}
2795        /* The rules.  */
2796
2797 \1f
2798 File: bison.info,  Node: Secure? Conform?,  Next: I can't build Bison,  Prev: Multiple start-symbols,  Up: FAQ
2799
2800 11.6 Secure?  Conform?
2801 ======================
2802
2803      Is Bison secure?  Does it conform to POSIX?
2804
2805    If you're looking for a guarantee or certification, we don't provide
2806 it.  However, Bison is intended to be a reliable program that conforms
2807 to the POSIX specification for Yacc.  If you run into problems, please
2808 send us a bug report.
2809
2810 \1f
2811 File: bison.info,  Node: I can't build Bison,  Next: Where can I find help?,  Prev: Secure? Conform?,  Up: FAQ
2812
2813 11.7 I can't build Bison
2814 ========================
2815
2816      I can't build Bison because `make' complains that `msgfmt' is not
2817      found.  What should I do?
2818
2819    Like most GNU packages with internationalization support, that
2820 feature is turned on by default.  If you have problems building in the
2821 `po' subdirectory, it indicates that your system's internationalization
2822 support is lacking.  You can re-configure Bison with `--disable-nls' to
2823 turn off this support, or you can install GNU gettext from
2824 `ftp://ftp.gnu.org/gnu/gettext/' and re-configure Bison.  See the file
2825 `ABOUT-NLS' for more information.
2826
2827 \1f
2828 File: bison.info,  Node: Where can I find help?,  Next: Bug Reports,  Prev: I can't build Bison,  Up: FAQ
2829
2830 11.8 Where can I find help?
2831 ===========================
2832
2833      I'm having trouble using Bison.  Where can I find help?
2834
2835    First, read this fine manual.  Beyond that, you can send mail to
2836 <help-bison@gnu.org>.  This mailing list is intended to be populated
2837 with people who are willing to answer questions about using and
2838 installing Bison.  Please keep in mind that (most of) the people on the
2839 list have aspects of their lives which are not related to Bison (!), so
2840 you may not receive an answer to your question right away.  This can be
2841 frustrating, but please try not to honk them off; remember that any
2842 help they provide is purely voluntary and out of the kindness of their
2843 hearts.
2844
2845 \1f
2846 File: bison.info,  Node: Bug Reports,  Next: More Languages,  Prev: Where can I find help?,  Up: FAQ
2847
2848 11.9 Bug Reports
2849 ================
2850
2851      I found a bug.  What should I include in the bug report?
2852
2853    Before you send a bug report, make sure you are using the latest
2854 version.  Check `ftp://ftp.gnu.org/pub/gnu/bison/' or one of its
2855 mirrors.  Be sure to include the version number in your bug report.  If
2856 the bug is present in the latest version but not in a previous version,
2857 try to determine the most recent version which did not contain the bug.
2858
2859    If the bug is parser-related, you should include the smallest grammar
2860 you can which demonstrates the bug.  The grammar file should also be
2861 complete (i.e., I should be able to run it through Bison without having
2862 to edit or add anything).  The smaller and simpler the grammar, the
2863 easier it will be to fix the bug.
2864
2865    Include information about your compilation environment, including
2866 your operating system's name and version and your compiler's name and
2867 version.  If you have trouble compiling, you should also include a
2868 transcript of the build session, starting with the invocation of
2869 `configure'.  Depending on the nature of the bug, you may be asked to
2870 send additional files as well (such as `config.h' or `config.cache').
2871
2872    Patches are most welcome, but not required.  That is, do not
2873 hesitate to send a bug report just because you cannot provide a fix.
2874
2875    Send bug reports to <bug-bison@gnu.org>.
2876
2877 \1f
2878 File: bison.info,  Node: More Languages,  Next: Beta Testing,  Prev: Bug Reports,  Up: FAQ
2879
2880 11.10 More Languages
2881 ====================
2882
2883      Will Bison ever have C++ and Java support?  How about INSERT YOUR
2884      FAVORITE LANGUAGE HERE?
2885
2886    C++ and Java support is there now, and is documented.  We'd love to
2887 add other languages; contributions are welcome.
2888
2889 \1f
2890 File: bison.info,  Node: Beta Testing,  Next: Mailing Lists,  Prev: More Languages,  Up: FAQ
2891
2892 11.11 Beta Testing
2893 ==================
2894
2895      What is involved in being a beta tester?
2896
2897    It's not terribly involved.  Basically, you would download a test
2898 release, compile it, and use it to build and run a parser or two.  After
2899 that, you would submit either a bug report or a message saying that
2900 everything is okay.  It is important to report successes as well as
2901 failures because test releases eventually become mainstream releases,
2902 but only if they are adequately tested.  If no one tests, development is
2903 essentially halted.
2904
2905    Beta testers are particularly needed for operating systems to which
2906 the developers do not have easy access.  They currently have easy
2907 access to recent GNU/Linux and Solaris versions.  Reports about other
2908 operating systems are especially welcome.
2909
2910 \1f
2911 File: bison.info,  Node: Mailing Lists,  Prev: Beta Testing,  Up: FAQ
2912
2913 11.12 Mailing Lists
2914 ===================
2915
2916      How do I join the help-bison and bug-bison mailing lists?
2917
2918    See `http://lists.gnu.org/'.
2919
2920 \1f
2921 File: bison.info,  Node: Table of Symbols,  Next: Glossary,  Prev: FAQ,  Up: Top
2922
2923 Annexe A Bison Symbols
2924 **********************
2925
2926  -- Variable: @$
2927      In an action, the location of the left-hand side of the rule.
2928      *Note Tracking Locations::.
2929
2930  -- Variable: @N
2931      In an action, the location of the N-th symbol of the right-hand
2932      side of the rule.  *Note Tracking Locations::.
2933
2934  -- Variable: @NAME
2935      In an action, the location of a symbol addressed by name.  *Note
2936      Tracking Locations::.
2937
2938  -- Variable: @[NAME]
2939      In an action, the location of a symbol addressed by name.  *Note
2940      Tracking Locations::.
2941
2942  -- Variable: $$
2943      In an action, the semantic value of the left-hand side of the rule.
2944      *Note Actions::.
2945
2946  -- Variable: $N
2947      In an action, the semantic value of the N-th symbol of the
2948      right-hand side of the rule.  *Note Actions::.
2949
2950  -- Variable: $NAME
2951      In an action, the semantic value of a symbol addressed by name.
2952      *Note Actions::.
2953
2954  -- Variable: $[NAME]
2955      In an action, the semantic value of a symbol addressed by name.
2956      *Note Actions::.
2957
2958  -- Delimiter: %%
2959      Delimiter used to separate the grammar rule section from the Bison
2960      declarations section or the epilogue.  *Note The Overall Layout of
2961      a Bison Grammar: Grammar Layout.
2962
2963  -- Delimiter: %{CODE%}
2964      All code listed between `%{' and `%}' is copied verbatim to the
2965      parser implementation file.  Such code forms the prologue of the
2966      grammar file.  *Note Outline of a Bison Grammar: Grammar Outline.
2967
2968  -- Construct: /*...*/
2969      Comment delimiters, as in C.
2970
2971  -- Delimiter: :
2972      Separates a rule's result from its components.  *Note Syntax of
2973      Grammar Rules: Rules.
2974
2975  -- Delimiter: ;
2976      Terminates a rule.  *Note Syntax of Grammar Rules: Rules.
2977
2978  -- Delimiter: |
2979      Separates alternate rules for the same result nonterminal.  *Note
2980      Syntax of Grammar Rules: Rules.
2981
2982  -- Directive: <*>
2983      Used to define a default tagged `%destructor' or default tagged
2984      `%printer'.
2985
2986      This feature is experimental.  More user feedback will help to
2987      determine whether it should become a permanent feature.
2988
2989      *Note Freeing Discarded Symbols: Destructor Decl.
2990
2991  -- Directive: <>
2992      Used to define a default tagless `%destructor' or default tagless
2993      `%printer'.
2994
2995      This feature is experimental.  More user feedback will help to
2996      determine whether it should become a permanent feature.
2997
2998      *Note Freeing Discarded Symbols: Destructor Decl.
2999
3000  -- Symbol: $accept
3001      The predefined nonterminal whose only rule is `$accept: START
3002      $end', where START is the start symbol.  *Note The Start-Symbol:
3003      Start Decl.  It cannot be used in the grammar.
3004
3005  -- Directive: %code {CODE}
3006  -- Directive: %code QUALIFIER {CODE}
3007      Insert CODE verbatim into the output parser source at the default
3008      location or at the location specified by QUALIFIER.  *Note %code
3009      Summary::.
3010
3011  -- Directive: %debug
3012      Equip the parser for debugging.  *Note Decl Summary::.
3013
3014  -- Directive: %define VARIABLE
3015  -- Directive: %define VARIABLE VALUE
3016  -- Directive: %define VARIABLE "VALUE"
3017      Define a variable to adjust Bison's behavior.  *Note %define
3018      Summary::.
3019
3020  -- Directive: %defines
3021      Bison declaration to create a parser header file, which is usually
3022      meant for the scanner.  *Note Decl Summary::.
3023
3024  -- Directive: %defines DEFINES-FILE
3025      Same as above, but save in the file DEFINES-FILE.  *Note Decl
3026      Summary::.
3027
3028  -- Directive: %destructor
3029      Specify how the parser should reclaim the memory associated to
3030      discarded symbols.  *Note Freeing Discarded Symbols: Destructor
3031      Decl.
3032
3033  -- Directive: %dprec
3034      Bison declaration to assign a precedence to a rule that is used at
3035      parse time to resolve reduce/reduce conflicts.  *Note Writing GLR
3036      Parsers: GLR Parsers.
3037
3038  -- Symbol: $end
3039      The predefined token marking the end of the token stream.  It
3040      cannot be used in the grammar.
3041
3042  -- Symbol: error
3043      A token name reserved for error recovery.  This token may be used
3044      in grammar rules so as to allow the Bison parser to recognize an
3045      error in the grammar without halting the process.  In effect, a
3046      sentence containing an error may be recognized as valid.  On a
3047      syntax error, the token `error' becomes the current lookahead
3048      token.  Actions corresponding to `error' are then executed, and
3049      the lookahead token is reset to the token that originally caused
3050      the violation.  *Note Error Recovery::.
3051
3052  -- Directive: %error-verbose
3053      Bison declaration to request verbose, specific error message
3054      strings when `yyerror' is called.  *Note Error Reporting::.
3055
3056  -- Directive: %file-prefix "PREFIX"
3057      Bison declaration to set the prefix of the output files.  *Note
3058      Decl Summary::.
3059
3060  -- Directive: %glr-parser
3061      Bison declaration to produce a GLR parser.  *Note Writing GLR
3062      Parsers: GLR Parsers.
3063
3064  -- Directive: %initial-action
3065      Run user code before parsing.  *Note Performing Actions before
3066      Parsing: Initial Action Decl.
3067
3068  -- Directive: %language
3069      Specify the programming language for the generated parser.  *Note
3070      Decl Summary::.
3071
3072  -- Directive: %left
3073      Bison declaration to assign left associativity to token(s).  *Note
3074      Operator Precedence: Precedence Decl.
3075
3076  -- Directive: %lex-param {ARGUMENT-DECLARATION}
3077      Bison declaration to specifying an additional parameter that
3078      `yylex' should accept.  *Note Calling Conventions for Pure
3079      Parsers: Pure Calling.
3080
3081  -- Directive: %merge
3082      Bison declaration to assign a merging function to a rule.  If
3083      there is a reduce/reduce conflict with a rule having the same
3084      merging function, the function is applied to the two semantic
3085      values to get a single result.  *Note Writing GLR Parsers: GLR
3086      Parsers.
3087
3088  -- Directive: %name-prefix "PREFIX"
3089      Obsoleted by the `%define' variable `api.prefix' (*note Multiple
3090      Parsers in the Same Program: Multiple Parsers.).
3091
3092      Rename the external symbols (variables and functions) used in the
3093      parser so that they start with PREFIX instead of `yy'.  Contrary to
3094      `api.prefix', do no rename types and macros.
3095
3096      The precise list of symbols renamed in C parsers is `yyparse',
3097      `yylex', `yyerror', `yynerrs', `yylval', `yychar', `yydebug', and
3098      (if locations are used) `yylloc'.  If you use a push parser,
3099      `yypush_parse', `yypull_parse', `yypstate', `yypstate_new' and
3100      `yypstate_delete' will also be renamed.  For example, if you use
3101      `%name-prefix "c_"', the names become `c_parse', `c_lex', and so
3102      on.  For C++ parsers, see the `%define namespace' documentation in
3103      this section.
3104
3105  -- Directive: %no-lines
3106      Bison declaration to avoid generating `#line' directives in the
3107      parser implementation file.  *Note Decl Summary::.
3108
3109  -- Directive: %nonassoc
3110      Bison declaration to assign nonassociativity to token(s).  *Note
3111      Operator Precedence: Precedence Decl.
3112
3113  -- Directive: %output "FILE"
3114      Bison declaration to set the name of the parser implementation
3115      file.  *Note Decl Summary::.
3116
3117  -- Directive: %parse-param {ARGUMENT-DECLARATION}
3118      Bison declaration to specifying an additional parameter that
3119      `yyparse' should accept.  *Note The Parser Function `yyparse':
3120      Parser Function.
3121
3122  -- Directive: %prec
3123      Bison declaration to assign a precedence to a specific rule.
3124      *Note Context-Dependent Precedence: Contextual Precedence.
3125
3126  -- Directive: %pure-parser
3127      Deprecated version of `%define api.pure' (*note api.pure: %define
3128      Summary.), for which Bison is more careful to warn about
3129      unreasonable usage.
3130
3131  -- Directive: %require "VERSION"
3132      Require version VERSION or higher of Bison.  *Note Require a
3133      Version of Bison: Require Decl.
3134
3135  -- Directive: %right
3136      Bison declaration to assign right associativity to token(s).
3137      *Note Operator Precedence: Precedence Decl.
3138
3139  -- Directive: %skeleton
3140      Specify the skeleton to use; usually for development.  *Note Decl
3141      Summary::.
3142
3143  -- Directive: %start
3144      Bison declaration to specify the start symbol.  *Note The
3145      Start-Symbol: Start Decl.
3146
3147  -- Directive: %token
3148      Bison declaration to declare token(s) without specifying
3149      precedence.  *Note Token Type Names: Token Decl.
3150
3151  -- Directive: %token-table
3152      Bison declaration to include a token name table in the parser
3153      implementation file.  *Note Decl Summary::.
3154
3155  -- Directive: %type
3156      Bison declaration to declare nonterminals.  *Note Nonterminal
3157      Symbols: Type Decl.
3158
3159  -- Symbol: $undefined
3160      The predefined token onto which all undefined values returned by
3161      `yylex' are mapped.  It cannot be used in the grammar, rather, use
3162      `error'.
3163
3164  -- Directive: %union
3165      Bison declaration to specify several possible data types for
3166      semantic values.  *Note The Collection of Value Types: Union Decl.
3167
3168  -- Macro: YYABORT
3169      Macro to pretend that an unrecoverable syntax error has occurred,
3170      by making `yyparse' return 1 immediately.  The error reporting
3171      function `yyerror' is not called.  *Note The Parser Function
3172      `yyparse': Parser Function.
3173
3174      For Java parsers, this functionality is invoked using `return
3175      YYABORT;' instead.
3176
3177  -- Macro: YYACCEPT
3178      Macro to pretend that a complete utterance of the language has been
3179      read, by making `yyparse' return 0 immediately.  *Note The Parser
3180      Function `yyparse': Parser Function.
3181
3182      For Java parsers, this functionality is invoked using `return
3183      YYACCEPT;' instead.
3184
3185  -- Macro: YYBACKUP
3186      Macro to discard a value from the parser stack and fake a lookahead
3187      token.  *Note Special Features for Use in Actions: Action Features.
3188
3189  -- Variable: yychar
3190      External integer variable that contains the integer value of the
3191      lookahead token.  (In a pure parser, it is a local variable within
3192      `yyparse'.)  Error-recovery rule actions may examine this variable.
3193      *Note Special Features for Use in Actions: Action Features.
3194
3195  -- Variable: yyclearin
3196      Macro used in error-recovery rule actions.  It clears the previous
3197      lookahead token.  *Note Error Recovery::.
3198
3199  -- Macro: YYDEBUG
3200      Macro to define to equip the parser with tracing code.  *Note
3201      Tracing Your Parser: Tracing.
3202
3203  -- Variable: yydebug
3204      External integer variable set to zero by default.  If `yydebug' is
3205      given a nonzero value, the parser will output information on input
3206      symbols and parser action.  *Note Tracing Your Parser: Tracing.
3207
3208  -- Macro: yyerrok
3209      Macro to cause parser to recover immediately to its normal mode
3210      after a syntax error.  *Note Error Recovery::.
3211
3212  -- Macro: YYERROR
3213      Cause an immediate syntax error.  This statement initiates error
3214      recovery just as if the parser itself had detected an error;
3215      however, it does not call `yyerror', and does not print any
3216      message.  If you want to print an error message, call `yyerror'
3217      explicitly before the `YYERROR;' statement.  *Note Error
3218      Recovery::.
3219
3220      For Java parsers, this functionality is invoked using `return
3221      YYERROR;' instead.
3222
3223  -- Function: yyerror
3224      User-supplied function to be called by `yyparse' on error.  *Note
3225      The Error Reporting Function `yyerror': Error Reporting.
3226
3227  -- Macro: YYERROR_VERBOSE
3228      An obsolete macro that you define with `#define' in the prologue
3229      to request verbose, specific error message strings when `yyerror'
3230      is called.  It doesn't matter what definition you use for
3231      `YYERROR_VERBOSE', just whether you define it.  Supported by the C
3232      skeletons only; using `%error-verbose' is preferred.  *Note Error
3233      Reporting::.
3234
3235  -- Macro: YYFPRINTF
3236      Macro used to output run-time traces.  *Note Enabling Traces::.
3237
3238  -- Macro: YYINITDEPTH
3239      Macro for specifying the initial size of the parser stack.  *Note
3240      Memory Management::.
3241
3242  -- Function: yylex
3243      User-supplied lexical analyzer function, called with no arguments
3244      to get the next token.  *Note The Lexical Analyzer Function
3245      `yylex': Lexical.
3246
3247  -- Macro: YYLEX_PARAM
3248      An obsolete macro for specifying an extra argument (or list of
3249      extra arguments) for `yyparse' to pass to `yylex'.  The use of this
3250      macro is deprecated, and is supported only for Yacc like parsers.
3251      *Note Calling Conventions for Pure Parsers: Pure Calling.
3252
3253  -- Variable: yylloc
3254      External variable in which `yylex' should place the line and column
3255      numbers associated with a token.  (In a pure parser, it is a local
3256      variable within `yyparse', and its address is passed to `yylex'.)
3257      You can ignore this variable if you don't use the `@' feature in
3258      the grammar actions.  *Note Textual Locations of Tokens: Token
3259      Locations.  In semantic actions, it stores the location of the
3260      lookahead token.  *Note Actions and Locations: Actions and
3261      Locations.
3262
3263  -- Type: YYLTYPE
3264      Data type of `yylloc'; by default, a structure with four members.
3265      *Note Data Types of Locations: Location Type.
3266
3267  -- Variable: yylval
3268      External variable in which `yylex' should place the semantic value
3269      associated with a token.  (In a pure parser, it is a local
3270      variable within `yyparse', and its address is passed to `yylex'.)
3271      *Note Semantic Values of Tokens: Token Values.  In semantic
3272      actions, it stores the semantic value of the lookahead token.
3273      *Note Actions: Actions.
3274
3275  -- Macro: YYMAXDEPTH
3276      Macro for specifying the maximum size of the parser stack.  *Note
3277      Memory Management::.
3278
3279  -- Variable: yynerrs
3280      Global variable which Bison increments each time it reports a
3281      syntax error.  (In a pure parser, it is a local variable within
3282      `yyparse'. In a pure push parser, it is a member of yypstate.)
3283      *Note The Error Reporting Function `yyerror': Error Reporting.
3284
3285  -- Function: yyparse
3286      The parser function produced by Bison; call this function to start
3287      parsing.  *Note The Parser Function `yyparse': Parser Function.
3288
3289  -- Macro: YYPRINT
3290      Macro used to output token semantic values.  For `yacc.c' only.
3291      Obsoleted by `%printer'.  *Note The `YYPRINT' Macro: The YYPRINT
3292      Macro.
3293
3294  -- Function: yypstate_delete
3295      The function to delete a parser instance, produced by Bison in
3296      push mode; call this function to delete the memory associated with
3297      a parser.  *Note The Parser Delete Function `yypstate_delete':
3298      Parser Delete Function.  (The current push parsing interface is
3299      experimental and may evolve.  More user feedback will help to
3300      stabilize it.)
3301
3302  -- Function: yypstate_new
3303      The function to create a parser instance, produced by Bison in
3304      push mode; call this function to create a new parser.  *Note The
3305      Parser Create Function `yypstate_new': Parser Create Function.
3306      (The current push parsing interface is experimental and may evolve.
3307      More user feedback will help to stabilize it.)
3308
3309  -- Function: yypull_parse
3310      The parser function produced by Bison in push mode; call this
3311      function to parse the rest of the input stream.  *Note The Pull
3312      Parser Function `yypull_parse': Pull Parser Function.  (The
3313      current push parsing interface is experimental and may evolve.
3314      More user feedback will help to stabilize it.)
3315
3316  -- Function: yypush_parse
3317      The parser function produced by Bison in push mode; call this
3318      function to parse a single token.  *Note The Push Parser Function
3319      `yypush_parse': Push Parser Function.  (The current push parsing
3320      interface is experimental and may evolve.  More user feedback will
3321      help to stabilize it.)
3322
3323  -- Macro: YYPARSE_PARAM
3324      An obsolete macro for specifying the name of a parameter that
3325      `yyparse' should accept.  The use of this macro is deprecated, and
3326      is supported only for Yacc like parsers.  *Note Calling
3327      Conventions for Pure Parsers: Pure Calling.
3328
3329  -- Macro: YYRECOVERING
3330      The expression `YYRECOVERING ()' yields 1 when the parser is
3331      recovering from a syntax error, and 0 otherwise.  *Note Special
3332      Features for Use in Actions: Action Features.
3333
3334  -- Macro: YYSTACK_USE_ALLOCA
3335      Macro used to control the use of `alloca' when the deterministic
3336      parser in C needs to extend its stacks.  If defined to 0, the
3337      parser will use `malloc' to extend its stacks.  If defined to 1,
3338      the parser will use `alloca'.  Values other than 0 and 1 are
3339      reserved for future Bison extensions.  If not defined,
3340      `YYSTACK_USE_ALLOCA' defaults to 0.
3341
3342      In the all-too-common case where your code may run on a host with a
3343      limited stack and with unreliable stack-overflow checking, you
3344      should set `YYMAXDEPTH' to a value that cannot possibly result in
3345      unchecked stack overflow on any of your target hosts when `alloca'
3346      is called.  You can inspect the code that Bison generates in order
3347      to determine the proper numeric values.  This will require some
3348      expertise in low-level implementation details.
3349
3350  -- Type: YYSTYPE
3351      Data type of semantic values; `int' by default.  *Note Data Types
3352      of Semantic Values: Value Type.
3353
3354 \1f
3355 File: bison.info,  Node: Glossary,  Next: Copying This Manual,  Prev: Table of Symbols,  Up: Top
3356
3357 Annexe B Glossary
3358 *****************
3359
3360 Accepting state
3361      A state whose only action is the accept action.  The accepting
3362      state is thus a consistent state.  *Note Understanding::.
3363
3364 Backus-Naur Form (BNF; also called "Backus Normal Form")
3365      Formal method of specifying context-free grammars originally
3366      proposed by John Backus, and slightly improved by Peter Naur in
3367      his 1960-01-02 committee document contributing to what became the
3368      Algol 60 report.  *Note Languages and Context-Free Grammars:
3369      Language and Grammar.
3370
3371 Consistent state
3372      A state containing only one possible action.  *Note Default
3373      Reductions::.
3374
3375 Context-free grammars
3376      Grammars specified as rules that can be applied regardless of
3377      context.  Thus, if there is a rule which says that an integer can
3378      be used as an expression, integers are allowed _anywhere_ an
3379      expression is permitted.  *Note Languages and Context-Free
3380      Grammars: Language and Grammar.
3381
3382 Default reduction
3383      The reduction that a parser should perform if the current parser
3384      state contains no other action for the lookahead token.  In
3385      permitted parser states, Bison declares the reduction with the
3386      largest lookahead set to be the default reduction and removes that
3387      lookahead set.  *Note Default Reductions::.
3388
3389 Defaulted state
3390      A consistent state with a default reduction.  *Note Default
3391      Reductions::.
3392
3393 Dynamic allocation
3394      Allocation of memory that occurs during execution, rather than at
3395      compile time or on entry to a function.
3396
3397 Empty string
3398      Analogous to the empty set in set theory, the empty string is a
3399      character string of length zero.
3400
3401 Finite-state stack machine
3402      A "machine" that has discrete states in which it is said to exist
3403      at each instant in time.  As input to the machine is processed, the
3404      machine moves from state to state as specified by the logic of the
3405      machine.  In the case of the parser, the input is the language
3406      being parsed, and the states correspond to various stages in the
3407      grammar rules.  *Note The Bison Parser Algorithm: Algorithm.
3408
3409 Generalized LR (GLR)
3410      A parsing algorithm that can handle all context-free grammars,
3411      including those that are not LR(1).  It resolves situations that
3412      Bison's deterministic parsing algorithm cannot by effectively
3413      splitting off multiple parsers, trying all possible parsers, and
3414      discarding those that fail in the light of additional right
3415      context.  *Note Generalized LR Parsing: Generalized LR Parsing.
3416
3417 Grouping
3418      A language construct that is (in general) grammatically divisible;
3419      for example, `expression' or `declaration' in C.  *Note Languages
3420      and Context-Free Grammars: Language and Grammar.
3421
3422 IELR(1) (Inadequacy Elimination LR(1))
3423      A minimal LR(1) parser table construction algorithm.  That is,
3424      given any context-free grammar, IELR(1) generates parser tables
3425      with the full language-recognition power of canonical LR(1) but
3426      with nearly the same number of parser states as LALR(1).  This
3427      reduction in parser states is often an order of magnitude.  More
3428      importantly, because canonical LR(1)'s extra parser states may
3429      contain duplicate conflicts in the case of non-LR(1) grammars, the
3430      number of conflicts for IELR(1) is often an order of magnitude
3431      less as well.  This can significantly reduce the complexity of
3432      developing a grammar.  *Note LR Table Construction::.
3433
3434 Infix operator
3435      An arithmetic operator that is placed between the operands on
3436      which it performs some operation.
3437
3438 Input stream
3439      A continuous flow of data between devices or programs.
3440
3441 LAC (Lookahead Correction)
3442      A parsing mechanism that fixes the problem of delayed syntax error
3443      detection, which is caused by LR state merging, default
3444      reductions, and the use of `%nonassoc'.  Delayed syntax error
3445      detection results in unexpected semantic actions, initiation of
3446      error recovery in the wrong syntactic context, and an incorrect
3447      list of expected tokens in a verbose syntax error message.  *Note
3448      LAC::.
3449
3450 Language construct
3451      One of the typical usage schemas of the language.  For example,
3452      one of the constructs of the C language is the `if' statement.
3453      *Note Languages and Context-Free Grammars: Language and Grammar.
3454
3455 Left associativity
3456      Operators having left associativity are analyzed from left to
3457      right: `a+b+c' first computes `a+b' and then combines with `c'.
3458      *Note Operator Precedence: Precedence.
3459
3460 Left recursion
3461      A rule whose result symbol is also its first component symbol; for
3462      example, `expseq1 : expseq1 ',' exp;'.  *Note Recursive Rules:
3463      Recursion.
3464
3465 Left-to-right parsing
3466      Parsing a sentence of a language by analyzing it token by token
3467      from left to right.  *Note The Bison Parser Algorithm: Algorithm.
3468
3469 Lexical analyzer (scanner)
3470      A function that reads an input stream and returns tokens one by
3471      one.  *Note The Lexical Analyzer Function `yylex': Lexical.
3472
3473 Lexical tie-in
3474      A flag, set by actions in the grammar rules, which alters the way
3475      tokens are parsed.  *Note Lexical Tie-ins::.
3476
3477 Literal string token
3478      A token which consists of two or more fixed characters.  *Note
3479      Symbols::.
3480
3481 Lookahead token
3482      A token already read but not yet shifted.  *Note Lookahead Tokens:
3483      Lookahead.
3484
3485 LALR(1)
3486      The class of context-free grammars that Bison (like most other
3487      parser generators) can handle by default; a subset of LR(1).
3488      *Note Mysterious Conflicts::.
3489
3490 LR(1)
3491      The class of context-free grammars in which at most one token of
3492      lookahead is needed to disambiguate the parsing of any piece of
3493      input.
3494
3495 Nonterminal symbol
3496      A grammar symbol standing for a grammatical construct that can be
3497      expressed through rules in terms of smaller constructs; in other
3498      words, a construct that is not a token.  *Note Symbols::.
3499
3500 Parser
3501      A function that recognizes valid sentences of a language by
3502      analyzing the syntax structure of a set of tokens passed to it
3503      from a lexical analyzer.
3504
3505 Postfix operator
3506      An arithmetic operator that is placed after the operands upon
3507      which it performs some operation.
3508
3509 Reduction
3510      Replacing a string of nonterminals and/or terminals with a single
3511      nonterminal, according to a grammar rule.  *Note The Bison Parser
3512      Algorithm: Algorithm.
3513
3514 Reentrant
3515      A reentrant subprogram is a subprogram which can be in invoked any
3516      number of times in parallel, without interference between the
3517      various invocations.  *Note A Pure (Reentrant) Parser: Pure Decl.
3518
3519 Reverse polish notation
3520      A language in which all operators are postfix operators.
3521
3522 Right recursion
3523      A rule whose result symbol is also its last component symbol; for
3524      example, `expseq1: exp ',' expseq1;'.  *Note Recursive Rules:
3525      Recursion.
3526
3527 Semantics
3528      In computer languages, the semantics are specified by the actions
3529      taken for each instance of the language, i.e., the meaning of each
3530      statement.  *Note Defining Language Semantics: Semantics.
3531
3532 Shift
3533      A parser is said to shift when it makes the choice of analyzing
3534      further input from the stream rather than reducing immediately some
3535      already-recognized rule.  *Note The Bison Parser Algorithm:
3536      Algorithm.
3537
3538 Single-character literal
3539      A single character that is recognized and interpreted as is.
3540      *Note From Formal Rules to Bison Input: Grammar in Bison.
3541
3542 Start symbol
3543      The nonterminal symbol that stands for a complete valid utterance
3544      in the language being parsed.  The start symbol is usually listed
3545      as the first nonterminal symbol in a language specification.
3546      *Note The Start-Symbol: Start Decl.
3547
3548 Symbol table
3549      A data structure where symbol names and associated data are stored
3550      during parsing to allow for recognition and use of existing
3551      information in repeated uses of a symbol.  *Note Multi-function
3552      Calc::.
3553
3554 Syntax error
3555      An error encountered during parsing of an input stream due to
3556      invalid syntax.  *Note Error Recovery::.
3557
3558 Token
3559      A basic, grammatically indivisible unit of a language.  The symbol
3560      that describes a token in the grammar is a terminal symbol.  The
3561      input of the Bison parser is a stream of tokens which comes from
3562      the lexical analyzer.  *Note Symbols::.
3563
3564 Terminal symbol
3565      A grammar symbol that has no rules in the grammar and therefore is
3566      grammatically indivisible.  The piece of text it represents is a
3567      token.  *Note Languages and Context-Free Grammars: Language and
3568      Grammar.
3569
3570 Unreachable state
3571      A parser state to which there does not exist a sequence of
3572      transitions from the parser's start state.  A state can become
3573      unreachable during conflict resolution.  *Note Unreachable
3574      States::.
3575
3576 \1f
3577 File: bison.info,  Node: Copying This Manual,  Next: Bibliography,  Prev: Glossary,  Up: Top
3578
3579 Annexe C Copying This Manual
3580 ****************************
3581
3582                      Version 1.3, 3 November 2008
3583
3584      Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
3585      `http://fsf.org/'
3586
3587      Everyone is permitted to copy and distribute verbatim copies
3588      of this license document, but changing it is not allowed.
3589
3590   0. PREAMBLE
3591
3592      The purpose of this License is to make a manual, textbook, or other
3593      functional and useful document "free" in the sense of freedom: to
3594      assure everyone the effective freedom to copy and redistribute it,
3595      with or without modifying it, either commercially or
3596      noncommercially.  Secondarily, this License preserves for the
3597      author and publisher a way to get credit for their work, while not
3598      being considered responsible for modifications made by others.
3599
3600      This License is a kind of "copyleft", which means that derivative
3601      works of the document must themselves be free in the same sense.
3602      It complements the GNU General Public License, which is a copyleft
3603      license designed for free software.
3604
3605      We have designed this License in order to use it for manuals for
3606      free software, because free software needs free documentation: a
3607      free program should come with manuals providing the same freedoms
3608      that the software does.  But this License is not limited to
3609      software manuals; it can be used for any textual work, regardless
3610      of subject matter or whether it is published as a printed book.
3611      We recommend this License principally for works whose purpose is
3612      instruction or reference.
3613
3614   1. APPLICABILITY AND DEFINITIONS
3615
3616      This License applies to any manual or other work, in any medium,
3617      that contains a notice placed by the copyright holder saying it
3618      can be distributed under the terms of this License.  Such a notice
3619      grants a world-wide, royalty-free license, unlimited in duration,
3620      to use that work under the conditions stated herein.  The
3621      "Document", below, refers to any such manual or work.  Any member
3622      of the public is a licensee, and is addressed as "you".  You
3623      accept the license if you copy, modify or distribute the work in a
3624      way requiring permission under copyright law.
3625
3626      A "Modified Version" of the Document means any work containing the
3627      Document or a portion of it, either copied verbatim, or with
3628      modifications and/or translated into another language.
3629
3630      A "Secondary Section" is a named appendix or a front-matter section
3631      of the Document that deals exclusively with the relationship of the
3632      publishers or authors of the Document to the Document's overall
3633      subject (or to related matters) and contains nothing that could
3634      fall directly within that overall subject.  (Thus, if the Document
3635      is in part a textbook of mathematics, a Secondary Section may not
3636      explain any mathematics.)  The relationship could be a matter of
3637      historical connection with the subject or with related matters, or
3638      of legal, commercial, philosophical, ethical or political position
3639      regarding them.
3640
3641      The "Invariant Sections" are certain Secondary Sections whose
3642      titles are designated, as being those of Invariant Sections, in
3643      the notice that says that the Document is released under this
3644      License.  If a section does not fit the above definition of
3645      Secondary then it is not allowed to be designated as Invariant.
3646      The Document may contain zero Invariant Sections.  If the Document
3647      does not identify any Invariant Sections then there are none.
3648
3649      The "Cover Texts" are certain short passages of text that are
3650      listed, as Front-Cover Texts or Back-Cover Texts, in the notice
3651      that says that the Document is released under this License.  A
3652      Front-Cover Text may be at most 5 words, and a Back-Cover Text may
3653      be at most 25 words.
3654
3655      A "Transparent" copy of the Document means a machine-readable copy,
3656      represented in a format whose specification is available to the
3657      general public, that is suitable for revising the document
3658      straightforwardly with generic text editors or (for images
3659      composed of pixels) generic paint programs or (for drawings) some
3660      widely available drawing editor, and that is suitable for input to
3661      text formatters or for automatic translation to a variety of
3662      formats suitable for input to text formatters.  A copy made in an
3663      otherwise Transparent file format whose markup, or absence of
3664      markup, has been arranged to thwart or discourage subsequent
3665      modification by readers is not Transparent.  An image format is
3666      not Transparent if used for any substantial amount of text.  A
3667      copy that is not "Transparent" is called "Opaque".
3668
3669      Examples of suitable formats for Transparent copies include plain
3670      ASCII without markup, Texinfo input format, LaTeX input format,
3671      SGML or XML using a publicly available DTD, and
3672      standard-conforming simple HTML, PostScript or PDF designed for
3673      human modification.  Examples of transparent image formats include
3674      PNG, XCF and JPG.  Opaque formats include proprietary formats that
3675      can be read and edited only by proprietary word processors, SGML or
3676      XML for which the DTD and/or processing tools are not generally
3677      available, and the machine-generated HTML, PostScript or PDF
3678      produced by some word processors for output purposes only.
3679
3680      The "Title Page" means, for a printed book, the title page itself,
3681      plus such following pages as are needed to hold, legibly, the
3682      material this License requires to appear in the title page.  For
3683      works in formats which do not have any title page as such, "Title
3684      Page" means the text near the most prominent appearance of the
3685      work's title, preceding the beginning of the body of the text.
3686
3687      The "publisher" means any person or entity that distributes copies
3688      of the Document to the public.
3689
3690      A section "Entitled XYZ" means a named subunit of the Document
3691      whose title either is precisely XYZ or contains XYZ in parentheses
3692      following text that translates XYZ in another language.  (Here XYZ
3693      stands for a specific section name mentioned below, such as
3694      "Acknowledgements", "Dedications", "Endorsements", or "History".)
3695      To "Preserve the Title" of such a section when you modify the
3696      Document means that it remains a section "Entitled XYZ" according
3697      to this definition.
3698
3699      The Document may include Warranty Disclaimers next to the notice
3700      which states that this License applies to the Document.  These
3701      Warranty Disclaimers are considered to be included by reference in
3702      this License, but only as regards disclaiming warranties: any other
3703      implication that these Warranty Disclaimers may have is void and
3704      has no effect on the meaning of this License.
3705
3706   2. VERBATIM COPYING
3707
3708      You may copy and distribute the Document in any medium, either
3709      commercially or noncommercially, provided that this License, the
3710      copyright notices, and the license notice saying this License
3711      applies to the Document are reproduced in all copies, and that you
3712      add no other conditions whatsoever to those of this License.  You
3713      may not use technical measures to obstruct or control the reading
3714      or further copying of the copies you make or distribute.  However,
3715      you may accept compensation in exchange for copies.  If you
3716      distribute a large enough number of copies you must also follow
3717      the conditions in section 3.
3718
3719      You may also lend copies, under the same conditions stated above,
3720      and you may publicly display copies.
3721
3722   3. COPYING IN QUANTITY
3723
3724      If you publish printed copies (or copies in media that commonly
3725      have printed covers) of the Document, numbering more than 100, and
3726      the Document's license notice requires Cover Texts, you must
3727      enclose the copies in covers that carry, clearly and legibly, all
3728      these Cover Texts: Front-Cover Texts on the front cover, and
3729      Back-Cover Texts on the back cover.  Both covers must also clearly
3730      and legibly identify you as the publisher of these copies.  The
3731      front cover must present the full title with all words of the
3732      title equally prominent and visible.  You may add other material
3733      on the covers in addition.  Copying with changes limited to the
3734      covers, as long as they preserve the title of the Document and
3735      satisfy these conditions, can be treated as verbatim copying in
3736      other respects.
3737
3738      If the required texts for either cover are too voluminous to fit
3739      legibly, you should put the first ones listed (as many as fit
3740      reasonably) on the actual cover, and continue the rest onto
3741      adjacent pages.
3742
3743      If you publish or distribute Opaque copies of the Document
3744      numbering more than 100, you must either include a
3745      machine-readable Transparent copy along with each Opaque copy, or
3746      state in or with each Opaque copy a computer-network location from
3747      which the general network-using public has access to download
3748      using public-standard network protocols a complete Transparent
3749      copy of the Document, free of added material.  If you use the
3750      latter option, you must take reasonably prudent steps, when you
3751      begin distribution of Opaque copies in quantity, to ensure that
3752      this Transparent copy will remain thus accessible at the stated
3753      location until at least one year after the last time you
3754      distribute an Opaque copy (directly or through your agents or
3755      retailers) of that edition to the public.
3756
3757      It is requested, but not required, that you contact the authors of
3758      the Document well before redistributing any large number of
3759      copies, to give them a chance to provide you with an updated
3760      version of the Document.
3761
3762   4. MODIFICATIONS
3763
3764      You may copy and distribute a Modified Version of the Document
3765      under the conditions of sections 2 and 3 above, provided that you
3766      release the Modified Version under precisely this License, with
3767      the Modified Version filling the role of the Document, thus
3768      licensing distribution and modification of the Modified Version to
3769      whoever possesses a copy of it.  In addition, you must do these
3770      things in the Modified Version:
3771
3772        A. Use in the Title Page (and on the covers, if any) a title
3773           distinct from that of the Document, and from those of
3774           previous versions (which should, if there were any, be listed
3775           in the History section of the Document).  You may use the
3776           same title as a previous version if the original publisher of
3777           that version gives permission.
3778
3779        B. List on the Title Page, as authors, one or more persons or
3780           entities responsible for authorship of the modifications in
3781           the Modified Version, together with at least five of the
3782           principal authors of the Document (all of its principal
3783           authors, if it has fewer than five), unless they release you
3784           from this requirement.
3785
3786        C. State on the Title page the name of the publisher of the
3787           Modified Version, as the publisher.
3788
3789        D. Preserve all the copyright notices of the Document.
3790
3791        E. Add an appropriate copyright notice for your modifications
3792           adjacent to the other copyright notices.
3793
3794        F. Include, immediately after the copyright notices, a license
3795           notice giving the public permission to use the Modified
3796           Version under the terms of this License, in the form shown in
3797           the Addendum below.
3798
3799        G. Preserve in that license notice the full lists of Invariant
3800           Sections and required Cover Texts given in the Document's
3801           license notice.
3802
3803        H. Include an unaltered copy of this License.
3804
3805        I. Preserve the section Entitled "History", Preserve its Title,
3806           and add to it an item stating at least the title, year, new
3807           authors, and publisher of the Modified Version as given on
3808           the Title Page.  If there is no section Entitled "History" in
3809           the Document, create one stating the title, year, authors,
3810           and publisher of the Document as given on its Title Page,
3811           then add an item describing the Modified Version as stated in
3812           the previous sentence.
3813
3814        J. Preserve the network location, if any, given in the Document
3815           for public access to a Transparent copy of the Document, and
3816           likewise the network locations given in the Document for
3817           previous versions it was based on.  These may be placed in
3818           the "History" section.  You may omit a network location for a
3819           work that was published at least four years before the
3820           Document itself, or if the original publisher of the version
3821           it refers to gives permission.
3822
3823        K. For any section Entitled "Acknowledgements" or "Dedications",
3824           Preserve the Title of the section, and preserve in the
3825           section all the substance and tone of each of the contributor
3826           acknowledgements and/or dedications given therein.
3827
3828        L. Preserve all the Invariant Sections of the Document,
3829           unaltered in their text and in their titles.  Section numbers
3830           or the equivalent are not considered part of the section
3831           titles.
3832
3833        M. Delete any section Entitled "Endorsements".  Such a section
3834           may not be included in the Modified Version.
3835
3836        N. Do not retitle any existing section to be Entitled
3837           "Endorsements" or to conflict in title with any Invariant
3838           Section.
3839
3840        O. Preserve any Warranty Disclaimers.
3841
3842      If the Modified Version includes new front-matter sections or
3843      appendices that qualify as Secondary Sections and contain no
3844      material copied from the Document, you may at your option
3845      designate some or all of these sections as invariant.  To do this,
3846      add their titles to the list of Invariant Sections in the Modified
3847      Version's license notice.  These titles must be distinct from any
3848      other section titles.
3849
3850      You may add a section Entitled "Endorsements", provided it contains
3851      nothing but endorsements of your Modified Version by various
3852      parties--for example, statements of peer review or that the text
3853      has been approved by an organization as the authoritative
3854      definition of a standard.
3855
3856      You may add a passage of up to five words as a Front-Cover Text,
3857      and a passage of up to 25 words as a Back-Cover Text, to the end
3858      of the list of Cover Texts in the Modified Version.  Only one
3859      passage of Front-Cover Text and one of Back-Cover Text may be
3860      added by (or through arrangements made by) any one entity.  If the
3861      Document already includes a cover text for the same cover,
3862      previously added by you or by arrangement made by the same entity
3863      you are acting on behalf of, you may not add another; but you may
3864      replace the old one, on explicit permission from the previous
3865      publisher that added the old one.
3866
3867      The author(s) and publisher(s) of the Document do not by this
3868      License give permission to use their names for publicity for or to
3869      assert or imply endorsement of any Modified Version.
3870
3871   5. COMBINING DOCUMENTS
3872
3873      You may combine the Document with other documents released under
3874      this License, under the terms defined in section 4 above for
3875      modified versions, provided that you include in the combination
3876      all of the Invariant Sections of all of the original documents,
3877      unmodified, and list them all as Invariant Sections of your
3878      combined work in its license notice, and that you preserve all
3879      their Warranty Disclaimers.
3880
3881      The combined work need only contain one copy of this License, and
3882      multiple identical Invariant Sections may be replaced with a single
3883      copy.  If there are multiple Invariant Sections with the same name
3884      but different contents, make the title of each such section unique
3885      by adding at the end of it, in parentheses, the name of the
3886      original author or publisher of that section if known, or else a
3887      unique number.  Make the same adjustment to the section titles in
3888      the list of Invariant Sections in the license notice of the
3889      combined work.
3890
3891      In the combination, you must combine any sections Entitled
3892      "History" in the various original documents, forming one section
3893      Entitled "History"; likewise combine any sections Entitled
3894      "Acknowledgements", and any sections Entitled "Dedications".  You
3895      must delete all sections Entitled "Endorsements."
3896
3897   6. COLLECTIONS OF DOCUMENTS
3898
3899      You may make a collection consisting of the Document and other
3900      documents released under this License, and replace the individual
3901      copies of this License in the various documents with a single copy
3902      that is included in the collection, provided that you follow the
3903      rules of this License for verbatim copying of each of the
3904      documents in all other respects.
3905
3906      You may extract a single document from such a collection, and
3907      distribute it individually under this License, provided you insert
3908      a copy of this License into the extracted document, and follow
3909      this License in all other respects regarding verbatim copying of
3910      that document.
3911
3912   7. AGGREGATION WITH INDEPENDENT WORKS
3913
3914      A compilation of the Document or its derivatives with other
3915      separate and independent documents or works, in or on a volume of
3916      a storage or distribution medium, is called an "aggregate" if the
3917      copyright resulting from the compilation is not used to limit the
3918      legal rights of the compilation's users beyond what the individual
3919      works permit.  When the Document is included in an aggregate, this
3920      License does not apply to the other works in the aggregate which
3921      are not themselves derivative works of the Document.
3922
3923      If the Cover Text requirement of section 3 is applicable to these
3924      copies of the Document, then if the Document is less than one half
3925      of the entire aggregate, the Document's Cover Texts may be placed
3926      on covers that bracket the Document within the aggregate, or the
3927      electronic equivalent of covers if the Document is in electronic
3928      form.  Otherwise they must appear on printed covers that bracket
3929      the whole aggregate.
3930
3931   8. TRANSLATION
3932
3933      Translation is considered a kind of modification, so you may
3934      distribute translations of the Document under the terms of section
3935      4.  Replacing Invariant Sections with translations requires special
3936      permission from their copyright holders, but you may include
3937      translations of some or all Invariant Sections in addition to the
3938      original versions of these Invariant Sections.  You may include a
3939      translation of this License, and all the license notices in the
3940      Document, and any Warranty Disclaimers, provided that you also
3941      include the original English version of this License and the
3942      original versions of those notices and disclaimers.  In case of a
3943      disagreement between the translation and the original version of
3944      this License or a notice or disclaimer, the original version will
3945      prevail.
3946
3947      If a section in the Document is Entitled "Acknowledgements",
3948      "Dedications", or "History", the requirement (section 4) to
3949      Preserve its Title (section 1) will typically require changing the
3950      actual title.
3951
3952   9. TERMINATION
3953
3954      You may not copy, modify, sublicense, or distribute the Document
3955      except as expressly provided under this License.  Any attempt
3956      otherwise to copy, modify, sublicense, or distribute it is void,
3957      and will automatically terminate your rights under this License.
3958
3959      However, if you cease all violation of this License, then your
3960      license from a particular copyright holder is reinstated (a)
3961      provisionally, unless and until the copyright holder explicitly
3962      and finally terminates your license, and (b) permanently, if the
3963      copyright holder fails to notify you of the violation by some
3964      reasonable means prior to 60 days after the cessation.
3965
3966      Moreover, your license from a particular copyright holder is
3967      reinstated permanently if the copyright holder notifies you of the
3968      violation by some reasonable means, this is the first time you have
3969      received notice of violation of this License (for any work) from
3970      that copyright holder, and you cure the violation prior to 30 days
3971      after your receipt of the notice.
3972
3973      Termination of your rights under this section does not terminate
3974      the licenses of parties who have received copies or rights from
3975      you under this License.  If your rights have been terminated and
3976      not permanently reinstated, receipt of a copy of some or all of
3977      the same material does not give you any rights to use it.
3978
3979  10. FUTURE REVISIONS OF THIS LICENSE
3980
3981      The Free Software Foundation may publish new, revised versions of
3982      the GNU Free Documentation License from time to time.  Such new
3983      versions will be similar in spirit to the present version, but may
3984      differ in detail to address new problems or concerns.  See
3985      `http://www.gnu.org/copyleft/'.
3986
3987      Each version of the License is given a distinguishing version
3988      number.  If the Document specifies that a particular numbered
3989      version of this License "or any later version" applies to it, you
3990      have the option of following the terms and conditions either of
3991      that specified version or of any later version that has been
3992      published (not as a draft) by the Free Software Foundation.  If
3993      the Document does not specify a version number of this License,
3994      you may choose any version ever published (not as a draft) by the
3995      Free Software Foundation.  If the Document specifies that a proxy
3996      can decide which future versions of this License can be used, that
3997      proxy's public statement of acceptance of a version permanently
3998      authorizes you to choose that version for the Document.
3999
4000  11. RELICENSING
4001
4002      "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
4003      World Wide Web server that publishes copyrightable works and also
4004      provides prominent facilities for anybody to edit those works.  A
4005      public wiki that anybody can edit is an example of such a server.
4006      A "Massive Multiauthor Collaboration" (or "MMC") contained in the
4007      site means any set of copyrightable works thus published on the MMC
4008      site.
4009
4010      "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
4011      license published by Creative Commons Corporation, a not-for-profit
4012      corporation with a principal place of business in San Francisco,
4013      California, as well as future copyleft versions of that license
4014      published by that same organization.
4015
4016      "Incorporate" means to publish or republish a Document, in whole or
4017      in part, as part of another Document.
4018
4019      An MMC is "eligible for relicensing" if it is licensed under this
4020      License, and if all works that were first published under this
4021      License somewhere other than this MMC, and subsequently
4022      incorporated in whole or in part into the MMC, (1) had no cover
4023      texts or invariant sections, and (2) were thus incorporated prior
4024      to November 1, 2008.
4025
4026      The operator of an MMC Site may republish an MMC contained in the
4027      site under CC-BY-SA on the same site at any time before August 1,
4028      2009, provided the MMC is eligible for relicensing.
4029
4030
4031 ADDENDUM: How to use this License for your documents
4032 ====================================================
4033
4034 To use this License in a document you have written, include a copy of
4035 the License in the document and put the following copyright and license
4036 notices just after the title page:
4037
4038        Copyright (C)  YEAR  YOUR NAME.
4039        Permission is granted to copy, distribute and/or modify this document
4040        under the terms of the GNU Free Documentation License, Version 1.3
4041        or any later version published by the Free Software Foundation;
4042        with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
4043        Texts.  A copy of the license is included in the section entitled ``GNU
4044        Free Documentation License''.
4045
4046    If you have Invariant Sections, Front-Cover Texts and Back-Cover
4047 Texts, replace the "with...Texts." line with this:
4048
4049          with the Invariant Sections being LIST THEIR TITLES, with
4050          the Front-Cover Texts being LIST, and with the Back-Cover Texts
4051          being LIST.
4052
4053    If you have Invariant Sections without Cover Texts, or some other
4054 combination of the three, merge those two alternatives to suit the
4055 situation.
4056
4057    If your document contains nontrivial examples of program code, we
4058 recommend releasing these examples in parallel under your choice of
4059 free software license, such as the GNU General Public License, to
4060 permit their use in free software.
4061
4062 \1f
4063 File: bison.info,  Node: Bibliography,  Next: Index of Terms,  Prev: Copying This Manual,  Up: Top
4064
4065 Bibliography
4066 ************
4067
4068 [Denny 2008]
4069      Joel E. Denny and Brian A. Malloy, IELR(1): Practical LR(1) Parser
4070      Tables for Non-LR(1) Grammars with Conflict Resolution, in
4071      `Proceedings of the 2008 ACM Symposium on Applied Computing'
4072      (SAC'08), ACM, New York, NY, USA, pp. 240-245.
4073      `http://dx.doi.org/10.1145/1363686.1363747'
4074
4075 [Denny 2010 May]
4076      Joel E. Denny, PSLR(1): Pseudo-Scannerless Minimal LR(1) for the
4077      Deterministic Parsing of Composite Languages, Ph.D. Dissertation,
4078      Clemson University, Clemson, SC, USA (May 2010).
4079      `http://proquest.umi.com/pqdlink?did=2041473591&Fmt=7&clientId=79356&RQT=309&VName=PQD'
4080
4081 [Denny 2010 November]
4082      Joel E. Denny and Brian A. Malloy, The IELR(1) Algorithm for
4083      Generating Minimal LR(1) Parser Tables for Non-LR(1) Grammars with
4084      Conflict Resolution, in `Science of Computer Programming', Vol.
4085      75, Issue 11 (November 2010), pp. 943-979.
4086      `http://dx.doi.org/10.1016/j.scico.2009.08.001'
4087
4088 [DeRemer 1982]
4089      Frank DeRemer and Thomas Pennello, Efficient Computation of LALR(1)
4090      Look-Ahead Sets, in `ACM Transactions on Programming Languages and
4091      Systems', Vol. 4, No. 4 (October 1982), pp.  615-649.
4092      `http://dx.doi.org/10.1145/69622.357187'
4093
4094 [Knuth 1965]
4095      Donald E. Knuth, On the Translation of Languages from Left to
4096      Right, in `Information and Control', Vol. 8, Issue 6 (December
4097      1965), pp.  607-639.
4098      `http://dx.doi.org/10.1016/S0019-9958(65)90426-2'
4099
4100 [Scott 2000]
4101      Elizabeth Scott, Adrian Johnstone, and Shamsa Sadaf Hussain,
4102      `Tomita-Style Generalised LR Parsers', Royal Holloway, University
4103      of London, Department of Computer Science, TR-00-12 (December
4104      2000).
4105      `http://www.cs.rhul.ac.uk/research/languages/publications/tomita_style_1.ps'
4106
4107 \1f
4108 File: bison.info,  Node: Index of Terms,  Prev: Bibliography,  Up: Top
4109
4110 Index of Terms
4111 **************
4112
4113 \0\b[index\0\b]
4114 * Menu:
4115
4116 * $ <1>:                                 Action Features.     (line  14)
4117 * $ <2>:                                 Table of Symbols.    (line  31)
4118 * $ <3>:                                 Java Action Features.
4119                                                               (line  13)
4120 * $:                                     Table of Symbols.    (line  35)
4121 * $$ <1>:                                Java Action Features.
4122                                                               (line  21)
4123 * $$ <2>:                                Actions.             (line   6)
4124 * $$ <3>:                                Action Features.     (line  10)
4125 * $$:                                    Table of Symbols.    (line  23)
4126 * $< <1>:                                Action Features.     (line  23)
4127 * $<:                                    Java Action Features.
4128                                                               (line  17)
4129 * $[NAME]:                               Actions.             (line   6)
4130 * $accept:                               Table of Symbols.    (line  81)
4131 * $end:                                  Table of Symbols.    (line 119)
4132 * $N:                                    Actions.             (line   6)
4133 * $NAME:                                 Actions.             (line   6)
4134 * $undefined:                            Table of Symbols.    (line 240)
4135 * % <1>:                                 Table of Symbols.    (line  44)
4136 * %:                                     Java Declarations Summary.
4137                                                               (line  53)
4138 * %% <1>:                                Table of Symbols.    (line  39)
4139 * %%:                                    Java Declarations Summary.
4140                                                               (line  49)
4141 * %code <1>:                             Decl Summary.        (line  47)
4142 * %code <2>:                             Java Declarations Summary.
4143                                                               (line  37)
4144 * %code <3>:                             %code Summary.       (line   6)
4145 * %code <4>:                             Prologue Alternatives.
4146                                                               (line   6)
4147 * %code <5>:                             Table of Symbols.    (line  86)
4148 * %code <6>:                             %code Summary.       (line  27)
4149 * %code <7>:                             Table of Symbols.    (line  87)
4150 * %code:                                 Calc++ Parser.       (line  65)
4151 * %code imports <1>:                     Java Declarations Summary.
4152                                                               (line  41)
4153 * %code imports:                         %code Summary.       (line  83)
4154 * %code lexer:                           Java Declarations Summary.
4155                                                               (line  45)
4156 * %code provides <1>:                    Decl Summary.        (line  95)
4157 * %code provides <2>:                    %code Summary.       (line  55)
4158 * %code provides:                        Prologue Alternatives.
4159                                                               (line   6)
4160 * %code requires <1>:                    Prologue Alternatives.
4161                                                               (line   6)
4162 * %code requires <2>:                    Decl Summary.        (line  95)
4163 * %code requires <3>:                    %code Summary.       (line  41)
4164 * %code requires:                        Calc++ Parser.       (line  17)
4165 * %code top <1>:                         Prologue Alternatives.
4166                                                               (line   6)
4167 * %code top:                             %code Summary.       (line  67)
4168 * %debug <1>:                            Table of Symbols.    (line  92)
4169 * %debug <2>:                            Enabling Traces.     (line  28)
4170 * %debug:                                Decl Summary.        (line  52)
4171 * %define <1>:                           Decl Summary.        (line  61)
4172 * %define <2>:                           %define Summary.     (line  15)
4173 * %define <3>:                           Decl Summary.        (line  59)
4174 * %define <4>:                           Table of Symbols.    (line  95)
4175 * %define:                               %define Summary.     (line  14)
4176 * %define abstract:                      Java Declarations Summary.
4177                                                               (line  57)
4178 * %define api.prefix:                    %define Summary.     (line  49)
4179 * %define api.pure <1>:                  %define Summary.     (line  62)
4180 * %define api.pure:                      Pure Decl.           (line   6)
4181 * %define api.push-pull <1>:             Push Decl.           (line   6)
4182 * %define api.push-pull:                 %define Summary.     (line  73)
4183 * %define extends:                       Java Declarations Summary.
4184                                                               (line  61)
4185 * %define final:                         Java Declarations Summary.
4186                                                               (line  65)
4187 * %define implements:                    Java Declarations Summary.
4188                                                               (line  69)
4189 * %define lex_throws:                    Java Declarations Summary.
4190                                                               (line  73)
4191 * %define location_type:                 Java Declarations Summary.
4192                                                               (line  78)
4193 * %define lr.default-reductions <1>:     Default Reductions.  (line   6)
4194 * %define lr.default-reductions:         %define Summary.     (line  86)
4195 * %define lr.default-reductions WHERE:   Default Reductions.  (line  84)
4196 * %define lr.keep-unreachable-states <1>: %define Summary.    (line 103)
4197 * %define lr.keep-unreachable-states:    Unreachable States.  (line   6)
4198 * %define lr.keep-unreachable-states VALUE: Unreachable States.
4199                                                               (line  17)
4200 * %define lr.type <1>:                   %define Summary.     (line 114)
4201 * %define lr.type:                       LR Table Construction.
4202                                                               (line   6)
4203 * %define lr.type TYPE:                  LR Table Construction.
4204                                                               (line  24)
4205 * %define namespace <1>:                 %define Summary.     (line 126)
4206 * %define namespace:                     C++ Bison Interface. (line  10)
4207 * %define package:                       Java Declarations Summary.
4208                                                               (line  84)
4209 * %define parse.lac <1>:                 LAC.                 (line   6)
4210 * %define parse.lac:                     %define Summary.     (line 166)
4211 * %define parse.lac VALUE:               LAC.                 (line  29)
4212 * %define parser_class_name:             Java Declarations Summary.
4213                                                               (line  88)
4214 * %define position_type:                 Java Declarations Summary.
4215                                                               (line  92)
4216 * %define public:                        Java Declarations Summary.
4217                                                               (line  97)
4218 * %define strictfp:                      Java Declarations Summary.
4219                                                               (line 105)
4220 * %define stype:                         Java Declarations Summary.
4221                                                               (line 101)
4222 * %define throws:                        Java Declarations Summary.
4223                                                               (line 109)
4224 * %defines <1>:                          Decl Summary.        (line  65)
4225 * %defines:                              Table of Symbols.    (line 101)
4226 * %destructor <1>:                       Table of Symbols.    (line 109)
4227 * %destructor <2>:                       Decl Summary.        (line 102)
4228 * %destructor <3>:                       Destructor Decl.     (line   6)
4229 * %destructor:                           Mid-Rule Actions.    (line  59)
4230 * %dprec <1>:                            Merging GLR Parses.  (line   6)
4231 * %dprec:                                Table of Symbols.    (line 114)
4232 * %error-verbose <1>:                    Error Reporting.     (line  17)
4233 * %error-verbose:                        Table of Symbols.    (line 133)
4234 * %expect <1>:                           Decl Summary.        (line  38)
4235 * %expect:                               Expect Decl.         (line   6)
4236 * %expect-rr <1>:                        Expect Decl.         (line   6)
4237 * %expect-rr:                            Simple GLR Parsers.  (line   6)
4238 * %file-prefix <1>:                      Table of Symbols.    (line 137)
4239 * %file-prefix:                          Decl Summary.        (line 107)
4240 * %glr-parser <1>:                       Simple GLR Parsers.  (line   6)
4241 * %glr-parser <2>:                       Table of Symbols.    (line 141)
4242 * %glr-parser:                           GLR Parsers.         (line   6)
4243 * %initial-action <1>:                   Table of Symbols.    (line 145)
4244 * %initial-action:                       Initial Action Decl. (line  11)
4245 * %language <1>:                         Table of Symbols.    (line 149)
4246 * %language:                             Decl Summary.        (line 111)
4247 * %language "Java":                      Java Declarations Summary.
4248                                                               (line  10)
4249 * %left <1>:                             Table of Symbols.    (line 153)
4250 * %left <2>:                             Using Precedence.    (line   6)
4251 * %left:                                 Decl Summary.        (line  21)
4252 * %lex-param <1>:                        Table of Symbols.    (line 157)
4253 * %lex-param <2>:                        Java Declarations Summary.
4254                                                               (line  13)
4255 * %lex-param:                            Pure Calling.        (line  31)
4256 * %locations:                            Decl Summary.        (line 119)
4257 * %merge <1>:                            Merging GLR Parses.  (line   6)
4258 * %merge:                                Table of Symbols.    (line 162)
4259 * %name-prefix <1>:                      Java Declarations Summary.
4260                                                               (line  19)
4261 * %name-prefix:                          Table of Symbols.    (line 169)
4262 * %no-lines <1>:                         Table of Symbols.    (line 186)
4263 * %no-lines:                             Decl Summary.        (line 126)
4264 * %nonassoc <1>:                         Decl Summary.        (line  25)
4265 * %nonassoc <2>:                         Table of Symbols.    (line 190)
4266 * %nonassoc <3>:                         Default Reductions.  (line   6)
4267 * %nonassoc <4>:                         LR Table Construction.
4268                                                               (line 103)
4269 * %nonassoc:                             Using Precedence.    (line   6)
4270 * %output <1>:                           Table of Symbols.    (line 194)
4271 * %output:                               Decl Summary.        (line 135)
4272 * %parse-param <1>:                      Parser Function.     (line  36)
4273 * %parse-param <2>:                      Java Declarations Summary.
4274                                                               (line  24)
4275 * %parse-param <3>:                      Parser Function.     (line  36)
4276 * %parse-param:                          Table of Symbols.    (line 198)
4277 * %prec <1>:                             Contextual Precedence.
4278                                                               (line   6)
4279 * %prec:                                 Table of Symbols.    (line 203)
4280 * %printer:                              Printer Decl.        (line   6)
4281 * %pure-parser <1>:                      Table of Symbols.    (line 207)
4282 * %pure-parser:                          Decl Summary.        (line 138)
4283 * %require <1>:                          Require Decl.        (line   6)
4284 * %require <2>:                          Decl Summary.        (line 143)
4285 * %require:                              Table of Symbols.    (line 212)
4286 * %right <1>:                            Using Precedence.    (line   6)
4287 * %right <2>:                            Table of Symbols.    (line 216)
4288 * %right:                                Decl Summary.        (line  17)
4289 * %skeleton <1>:                         Table of Symbols.    (line 220)
4290 * %skeleton:                             Decl Summary.        (line 147)
4291 * %start <1>:                            Start Decl.          (line   6)
4292 * %start <2>:                            Decl Summary.        (line  34)
4293 * %start:                                Table of Symbols.    (line 224)
4294 * %token <1>:                            Decl Summary.        (line  13)
4295 * %token <2>:                            Java Declarations Summary.
4296                                                               (line  29)
4297 * %token <3>:                            Table of Symbols.    (line 228)
4298 * %token:                                Token Decl.          (line   6)
4299 * %token-table <1>:                      Decl Summary.        (line 155)
4300 * %token-table:                          Table of Symbols.    (line 232)
4301 * %type <1>:                             Type Decl.           (line   6)
4302 * %type <2>:                             Table of Symbols.    (line 236)
4303 * %type <3>:                             Decl Summary.        (line  30)
4304 * %type:                                 Java Declarations Summary.
4305                                                               (line  33)
4306 * %union <1>:                            Decl Summary.        (line   9)
4307 * %union <2>:                            Union Decl.          (line   6)
4308 * %union:                                Table of Symbols.    (line 245)
4309 * %verbose:                              Decl Summary.        (line 188)
4310 * %yacc:                                 Decl Summary.        (line 194)
4311 * /*:                                    Table of Symbols.    (line  49)
4312 * ::                                     Table of Symbols.    (line  52)
4313 * ;:                                     Table of Symbols.    (line  56)
4314 * <*> <1>:                               Printer Decl.        (line   6)
4315 * <*> <2>:                               Table of Symbols.    (line  63)
4316 * <*>:                                   Destructor Decl.     (line   6)
4317 * <> <1>:                                Printer Decl.        (line   6)
4318 * <> <2>:                                Table of Symbols.    (line  72)
4319 * <>:                                    Destructor Decl.     (line   6)
4320 * @$ <1>:                                Table of Symbols.    (line   7)
4321 * @$ <2>:                                Actions and Locations.
4322                                                               (line   6)
4323 * @$ <3>:                                Action Features.     (line  98)
4324 * @$:                                    Java Action Features.
4325                                                               (line  39)
4326 * @[:                                    Table of Symbols.    (line  19)
4327 * @[NAME]:                               Actions and Locations.
4328                                                               (line   6)
4329 * @N <1>:                                Action Features.     (line 104)
4330 * @N <2>:                                Actions and Locations.
4331                                                               (line   6)
4332 * @N <3>:                                Java Action Features.
4333                                                               (line  35)
4334 * @N:                                    Table of Symbols.    (line  11)
4335 * @NAME <1>:                             Actions and Locations.
4336                                                               (line   6)
4337 * @NAME:                                 Table of Symbols.    (line  15)
4338 * abstract syntax tree:                  Implementing Gotos/Loops.
4339                                                               (line  17)
4340 * accepting state:                       Understanding.       (line 178)
4341 * action:                                Actions.             (line   6)
4342 * action data types:                     Action Types.        (line   6)
4343 * action features summary:               Action Features.     (line   6)
4344 * actions in mid-rule <1>:               Destructor Decl.     (line  88)
4345 * actions in mid-rule:                   Mid-Rule Actions.    (line   6)
4346 * actions, location:                     Actions and Locations.
4347                                                               (line   6)
4348 * actions, semantic:                     Semantic Actions.    (line   6)
4349 * additional C code section:             Epilogue.            (line   6)
4350 * algorithm of parser:                   Algorithm.           (line   6)
4351 * ambiguous grammars <1>:                Generalized LR Parsing.
4352                                                               (line   6)
4353 * ambiguous grammars:                    Language and Grammar.
4354                                                               (line  34)
4355 * associativity:                         Why Precedence.      (line  34)
4356 * AST:                                   Implementing Gotos/Loops.
4357                                                               (line  17)
4358 * Backus-Naur form:                      Language and Grammar.
4359                                                               (line  16)
4360 * begin of Location:                     Java Location Values.
4361                                                               (line  21)
4362 * begin of location:                     C++ location.        (line  22)
4363 * Bison declaration summary:             Decl Summary.        (line   6)
4364 * Bison declarations:                    Declarations.        (line   6)
4365 * Bison declarations (introduction):     Bison Declarations.  (line   6)
4366 * Bison grammar:                         Grammar in Bison.    (line   6)
4367 * Bison invocation:                      Invocation.          (line   6)
4368 * Bison parser:                          Bison Parser.        (line   6)
4369 * Bison parser algorithm:                Algorithm.           (line   6)
4370 * Bison symbols, table of:               Table of Symbols.    (line   6)
4371 * Bison utility:                         Bison Parser.        (line   6)
4372 * bison-i18n.m4:                         Internationalization.
4373                                                               (line  20)
4374 * bison-po:                              Internationalization.
4375                                                               (line   6)
4376 * BISON_I18N:                            Internationalization.
4377                                                               (line  27)
4378 * BISON_LOCALEDIR:                       Internationalization.
4379                                                               (line  27)
4380 * BNF:                                   Language and Grammar.
4381                                                               (line  16)
4382 * braced code:                           Rules.               (line  29)
4383 * C code, section for additional:        Epilogue.            (line   6)
4384 * C-language interface:                  Interface.           (line   6)
4385 * calc:                                  Infix Calc.          (line   6)
4386 * calculator, infix notation:            Infix Calc.          (line   6)
4387 * calculator, location tracking:         Location Tracking Calc.
4388                                                               (line   6)
4389 * calculator, multi-function:            Multi-function Calc. (line   6)
4390 * calculator, simple:                    RPN Calc.            (line   6)
4391 * canonical LR <1>:                      Mysterious Conflicts.
4392                                                               (line  45)
4393 * canonical LR:                          LR Table Construction.
4394                                                               (line   6)
4395 * character token:                       Symbols.             (line  37)
4396 * column of position:                    C++ position.        (line  29)
4397 * columns on location:                   C++ location.        (line  26)
4398 * columns on position:                   C++ position.        (line  32)
4399 * compiling the parser:                  Rpcalc Compile.      (line   6)
4400 * conflicts <1>:                         Shift/Reduce.        (line   6)
4401 * conflicts <2>:                         Merging GLR Parses.  (line   6)
4402 * conflicts <3>:                         Simple GLR Parsers.  (line   6)
4403 * conflicts:                             GLR Parsers.         (line   6)
4404 * conflicts, reduce/reduce:              Reduce/Reduce.       (line   6)
4405 * conflicts, suppressing warnings of:    Expect Decl.         (line   6)
4406 * consistent states:                     Default Reductions.  (line  17)
4407 * context-dependent precedence:          Contextual Precedence.
4408                                                               (line   6)
4409 * context-free grammar:                  Language and Grammar.
4410                                                               (line   6)
4411 * controlling function:                  Rpcalc Main.         (line   6)
4412 * core, item set:                        Understanding.       (line 125)
4413 * dangling else:                         Shift/Reduce.        (line   6)
4414 * data type of locations:                Location Type.       (line   6)
4415 * data types in actions:                 Action Types.        (line   6)
4416 * data types of semantic values:         Value Type.          (line   6)
4417 * debug_level on parser:                 C++ Parser Interface.
4418                                                               (line  38)
4419 * debug_stream on parser:                C++ Parser Interface.
4420                                                               (line  33)
4421 * debugging:                             Tracing.             (line   6)
4422 * declaration summary:                   Decl Summary.        (line   6)
4423 * declarations:                          Prologue.            (line   6)
4424 * declarations section:                  Prologue.            (line   6)
4425 * declarations, Bison:                   Declarations.        (line   6)
4426 * declarations, Bison (introduction):    Bison Declarations.  (line   6)
4427 * declaring literal string tokens:       Token Decl.          (line   6)
4428 * declaring operator precedence:         Precedence Decl.     (line   6)
4429 * declaring the start symbol:            Start Decl.          (line   6)
4430 * declaring token type names:            Token Decl.          (line   6)
4431 * declaring value types:                 Union Decl.          (line   6)
4432 * declaring value types, nonterminals:   Type Decl.           (line   6)
4433 * default action:                        Actions.             (line  62)
4434 * default data type:                     Value Type.          (line   6)
4435 * default location type:                 Location Type.       (line   6)
4436 * default reductions:                    Default Reductions.  (line   6)
4437 * default stack limit:                   Memory Management.   (line  30)
4438 * default start symbol:                  Start Decl.          (line   6)
4439 * defaulted states:                      Default Reductions.  (line  17)
4440 * deferred semantic actions:             GLR Semantic Actions.
4441                                                               (line   6)
4442 * defining language semantics:           Semantics.           (line   6)
4443 * delayed syntax error detection <1>:    LR Table Construction.
4444                                                               (line 103)
4445 * delayed syntax error detection:        Default Reductions.  (line  43)
4446 * delayed yylex invocations:             Default Reductions.  (line  17)
4447 * discarded symbols:                     Destructor Decl.     (line  98)
4448 * discarded symbols, mid-rule actions:   Mid-Rule Actions.    (line  59)
4449 * else, dangling:                        Shift/Reduce.        (line   6)
4450 * end of location:                       C++ location.        (line  23)
4451 * end of Location:                       Java Location Values.
4452                                                               (line  22)
4453 * epilogue:                              Epilogue.            (line   6)
4454 * error <1>:                             Error Recovery.      (line  20)
4455 * error:                                 Table of Symbols.    (line 123)
4456 * error on parser:                       C++ Parser Interface.
4457                                                               (line  44)
4458 * error recovery:                        Error Recovery.      (line   6)
4459 * error recovery, mid-rule actions:      Mid-Rule Actions.    (line  59)
4460 * error recovery, simple:                Simple Error Recovery.
4461                                                               (line   6)
4462 * error reporting function:              Error Reporting.     (line   6)
4463 * error reporting routine:               Rpcalc Error.        (line   6)
4464 * examples, simple:                      Examples.            (line   6)
4465 * exercises:                             Exercises.           (line   6)
4466 * file format:                           Grammar Layout.      (line   6)
4467 * file of position:                      C++ position.        (line  17)
4468 * finite-state machine:                  Parser States.       (line   6)
4469 * formal grammar:                        Grammar in Bison.    (line   6)
4470 * format of grammar file:                Grammar Layout.      (line   6)
4471 * freeing discarded symbols:             Destructor Decl.     (line   6)
4472 * frequently asked questions:            FAQ.                 (line   6)
4473 * generalized LR (GLR) parsing <1>:      Language and Grammar.
4474                                                               (line  34)
4475 * generalized LR (GLR) parsing <2>:      GLR Parsers.         (line   6)
4476 * generalized LR (GLR) parsing:          Generalized LR Parsing.
4477                                                               (line   6)
4478 * generalized LR (GLR) parsing, ambiguous grammars: Merging GLR Parses.
4479                                                               (line   6)
4480 * generalized LR (GLR) parsing, unambiguous grammars: Simple GLR Parsers.
4481                                                               (line   6)
4482 * getDebugLevel on YYParser:             Java Parser Interface.
4483                                                               (line  67)
4484 * getDebugStream on YYParser:            Java Parser Interface.
4485                                                               (line  62)
4486 * getEndPos on Lexer:                    Java Scanner Interface.
4487                                                               (line  39)
4488 * getLVal on Lexer:                      Java Scanner Interface.
4489                                                               (line  47)
4490 * getStartPos on Lexer:                  Java Scanner Interface.
4491                                                               (line  38)
4492 * gettext:                               Internationalization.
4493                                                               (line   6)
4494 * glossary:                              Glossary.            (line   6)
4495 * GLR parsers and inline:                Compiler Requirements.
4496                                                               (line   6)
4497 * GLR parsers and yychar:                GLR Semantic Actions.
4498                                                               (line  10)
4499 * GLR parsers and yyclearin:             GLR Semantic Actions.
4500                                                               (line  18)
4501 * GLR parsers and YYERROR:               GLR Semantic Actions.
4502                                                               (line  28)
4503 * GLR parsers and yylloc:                GLR Semantic Actions.
4504                                                               (line  10)
4505 * GLR parsers and YYLLOC_DEFAULT:        Location Default Action.
4506                                                               (line   6)
4507 * GLR parsers and yylval:                GLR Semantic Actions.
4508                                                               (line  10)
4509 * GLR parsing <1>:                       Generalized LR Parsing.
4510                                                               (line   6)
4511 * GLR parsing <2>:                       GLR Parsers.         (line   6)
4512 * GLR parsing:                           Language and Grammar.
4513                                                               (line  34)
4514 * GLR parsing, ambiguous grammars:       Merging GLR Parses.  (line   6)
4515 * GLR parsing, unambiguous grammars:     Simple GLR Parsers.  (line   6)
4516 * GLR with LALR:                         LR Table Construction.
4517                                                               (line  65)
4518 * grammar file:                          Grammar Layout.      (line   6)
4519 * grammar rule syntax:                   Rules.               (line   6)
4520 * grammar rules section:                 Grammar Rules.       (line   6)
4521 * grammar, Bison:                        Grammar in Bison.    (line   6)
4522 * grammar, context-free:                 Language and Grammar.
4523                                                               (line   6)
4524 * grouping, syntactic:                   Language and Grammar.
4525                                                               (line  48)
4526 * i18n:                                  Internationalization.
4527                                                               (line   6)
4528 * IELR <1>:                              LR Table Construction.
4529                                                               (line   6)
4530 * IELR:                                  Mysterious Conflicts.
4531                                                               (line  45)
4532 * IELR grammars:                         Language and Grammar.
4533                                                               (line  22)
4534 * infix notation calculator:             Infix Calc.          (line   6)
4535 * initialize on location:                C++ location.        (line  19)
4536 * initialize on position:                C++ position.        (line  14)
4537 * inline:                                Compiler Requirements.
4538                                                               (line   6)
4539 * interface:                             Interface.           (line   6)
4540 * internationalization:                  Internationalization.
4541                                                               (line   6)
4542 * introduction:                          Introduction.        (line   6)
4543 * invoking Bison:                        Invocation.          (line   6)
4544 * item:                                  Understanding.       (line 103)
4545 * item set core:                         Understanding.       (line 125)
4546 * kernel, item set:                      Understanding.       (line 125)
4547 * LAC <1>:                               LR Table Construction.
4548                                                               (line 103)
4549 * LAC <2>:                               Default Reductions.  (line  54)
4550 * LAC:                                   LAC.                 (line   6)
4551 * LALR <1>:                              Mysterious Conflicts.
4552                                                               (line  33)
4553 * LALR:                                  LR Table Construction.
4554                                                               (line   6)
4555 * LALR grammars:                         Language and Grammar.
4556                                                               (line  22)
4557 * language semantics, defining:          Semantics.           (line   6)
4558 * layout of Bison grammar:               Grammar Layout.      (line   6)
4559 * left recursion:                        Recursion.           (line  17)
4560 * lex-param:                             Pure Calling.        (line  31)
4561 * lexical analyzer:                      Lexical.             (line   6)
4562 * lexical analyzer, purpose:             Bison Parser.        (line   6)
4563 * lexical analyzer, writing:             Rpcalc Lexer.        (line   6)
4564 * lexical tie-in:                        Lexical Tie-ins.     (line   6)
4565 * line of position:                      C++ position.        (line  23)
4566 * lines on location:                     C++ location.        (line  27)
4567 * lines on position:                     C++ position.        (line  26)
4568 * literal string token:                  Symbols.             (line  59)
4569 * literal token:                         Symbols.             (line  37)
4570 * location <1>:                          Tracking Locations.  (line   6)
4571 * location:                              Locations.           (line   6)
4572 * location actions:                      Actions and Locations.
4573                                                               (line   6)
4574 * Location on Location:                  Java Location Values.
4575                                                               (line  29)
4576 * location on location:                  C++ location.        (line   8)
4577 * Location on Location:                  Java Location Values.
4578                                                               (line  25)
4579 * location tracking calculator:          Location Tracking Calc.
4580                                                               (line   6)
4581 * location, textual <1>:                 Locations.           (line   6)
4582 * location, textual:                     Tracking Locations.  (line   6)
4583 * location_type:                         C++ Parser Interface.
4584                                                               (line  16)
4585 * lookahead correction:                  LAC.                 (line   6)
4586 * lookahead token:                       Lookahead.           (line   6)
4587 * LR:                                    Mysterious Conflicts.
4588                                                               (line  33)
4589 * LR grammars:                           Language and Grammar.
4590                                                               (line  22)
4591 * ltcalc:                                Location Tracking Calc.
4592                                                               (line   6)
4593 * main function in simple example:       Rpcalc Main.         (line   6)
4594 * memory exhaustion:                     Memory Management.   (line   6)
4595 * memory management:                     Memory Management.   (line   6)
4596 * mfcalc:                                Multi-function Calc. (line   6)
4597 * mid-rule actions <1>:                  Mid-Rule Actions.    (line   6)
4598 * mid-rule actions:                      Destructor Decl.     (line  88)
4599 * multi-function calculator:             Multi-function Calc. (line   6)
4600 * multicharacter literal:                Symbols.             (line  59)
4601 * mutual recursion:                      Recursion.           (line  34)
4602 * Mysterious Conflict:                   LR Table Construction.
4603                                                               (line   6)
4604 * Mysterious Conflicts:                  Mysterious Conflicts.
4605                                                               (line   6)
4606 * named references:                      Named References.    (line   6)
4607 * NLS:                                   Internationalization.
4608                                                               (line   6)
4609 * nondeterministic parsing <1>:          Generalized LR Parsing.
4610                                                               (line   6)
4611 * nondeterministic parsing:              Language and Grammar.
4612                                                               (line  34)
4613 * nonterminal symbol:                    Symbols.             (line   6)
4614 * nonterminal, useless:                  Understanding.       (line  49)
4615 * operator precedence:                   Precedence.          (line   6)
4616 * operator precedence, declaring:        Precedence Decl.     (line   6)
4617 * operator!= on location:                C++ location.        (line  39)
4618 * operator!= on position:                C++ position.        (line  42)
4619 * operator+ on location:                 C++ location.        (line  30)
4620 * operator+ on position:                 C++ position.        (line  36)
4621 * operator+= on location:                C++ location.        (line  32)
4622 * operator+= on position:                C++ position.        (line  35)
4623 * operator- on position:                 C++ position.        (line  38)
4624 * operator-= on position:                C++ position.        (line  37)
4625 * operator<< <1>:                        C++ position.        (line  46)
4626 * operator<<:                            C++ location.        (line  44)
4627 * operator== on location:                C++ location.        (line  38)
4628 * operator== on position:                C++ position.        (line  41)
4629 * options for invoking Bison:            Invocation.          (line   6)
4630 * overflow of parser stack:              Memory Management.   (line   6)
4631 * parse error:                           Error Reporting.     (line   6)
4632 * parse on parser:                       C++ Parser Interface.
4633                                                               (line  30)
4634 * parse on YYParser:                     Java Parser Interface.
4635                                                               (line  54)
4636 * parser:                                Bison Parser.        (line   6)
4637 * parser on parser:                      C++ Parser Interface.
4638                                                               (line  26)
4639 * parser stack:                          Algorithm.           (line   6)
4640 * parser stack overflow:                 Memory Management.   (line   6)
4641 * parser state:                          Parser States.       (line   6)
4642 * pointed rule:                          Understanding.       (line 103)
4643 * polish notation calculator:            RPN Calc.            (line   6)
4644 * position on position:                  C++ position.        (line   8)
4645 * precedence declarations:               Precedence Decl.     (line   6)
4646 * precedence of operators:               Precedence.          (line   6)
4647 * precedence, context-dependent:         Contextual Precedence.
4648                                                               (line   6)
4649 * precedence, unary operator:            Contextual Precedence.
4650                                                               (line   6)
4651 * preventing warnings about conflicts:   Expect Decl.         (line   6)
4652 * printing semantic values:              Printer Decl.        (line   6)
4653 * Prologue <1>:                          Prologue.            (line   6)
4654 * Prologue:                              %code Summary.       (line   6)
4655 * Prologue Alternatives:                 Prologue Alternatives.
4656                                                               (line   6)
4657 * pure parser:                           Pure Decl.           (line   6)
4658 * push parser:                           Push Decl.           (line   6)
4659 * questions:                             FAQ.                 (line   6)
4660 * recovering:                            Java Action Features.
4661                                                               (line  55)
4662 * recovering on YYParser:                Java Parser Interface.
4663                                                               (line  58)
4664 * recovery from errors:                  Error Recovery.      (line   6)
4665 * recursive rule:                        Recursion.           (line   6)
4666 * reduce/reduce conflict:                Reduce/Reduce.       (line   6)
4667 * reduce/reduce conflicts <1>:           Merging GLR Parses.  (line   6)
4668 * reduce/reduce conflicts <2>:           GLR Parsers.         (line   6)
4669 * reduce/reduce conflicts:               Simple GLR Parsers.  (line   6)
4670 * reduction:                             Algorithm.           (line   6)
4671 * reentrant parser:                      Pure Decl.           (line   6)
4672 * requiring a version of Bison:          Require Decl.        (line   6)
4673 * reverse polish notation:               RPN Calc.            (line   6)
4674 * right recursion:                       Recursion.           (line  17)
4675 * rpcalc:                                RPN Calc.            (line   6)
4676 * rule syntax:                           Rules.               (line   6)
4677 * rule, pointed:                         Understanding.       (line 103)
4678 * rule, useless:                         Understanding.       (line  49)
4679 * rules section for grammar:             Grammar Rules.       (line   6)
4680 * running Bison (introduction):          Rpcalc Generate.     (line   6)
4681 * semantic actions:                      Semantic Actions.    (line   6)
4682 * semantic value:                        Semantic Values.     (line   6)
4683 * semantic value type:                   Value Type.          (line   6)
4684 * semantic_type:                         C++ Parser Interface.
4685                                                               (line  15)
4686 * set_debug_level on parser:             C++ Parser Interface.
4687                                                               (line  39)
4688 * set_debug_stream on parser:            C++ Parser Interface.
4689                                                               (line  34)
4690 * setDebugLevel on YYParser:             Java Parser Interface.
4691                                                               (line  68)
4692 * setDebugStream on YYParser:            Java Parser Interface.
4693                                                               (line  63)
4694 * shift/reduce conflicts <1>:            Shift/Reduce.        (line   6)
4695 * shift/reduce conflicts <2>:            Simple GLR Parsers.  (line   6)
4696 * shift/reduce conflicts:                GLR Parsers.         (line   6)
4697 * shifting:                              Algorithm.           (line   6)
4698 * simple examples:                       Examples.            (line   6)
4699 * single-character literal:              Symbols.             (line  37)
4700 * stack overflow:                        Memory Management.   (line   6)
4701 * stack, parser:                         Algorithm.           (line   6)
4702 * stages in using Bison:                 Stages.              (line   6)
4703 * start symbol:                          Language and Grammar.
4704                                                               (line  97)
4705 * start symbol, declaring:               Start Decl.          (line   6)
4706 * state (of parser):                     Parser States.       (line   6)
4707 * step on location:                      C++ location.        (line  35)
4708 * string token:                          Symbols.             (line  59)
4709 * summary, action features:              Action Features.     (line   6)
4710 * summary, Bison declaration:            Decl Summary.        (line   6)
4711 * suppressing conflict warnings:         Expect Decl.         (line   6)
4712 * symbol:                                Symbols.             (line   6)
4713 * symbol table example:                  Mfcalc Symbol Table. (line   6)
4714 * symbols (abstract):                    Language and Grammar.
4715                                                               (line  48)
4716 * symbols in Bison, table of:            Table of Symbols.    (line   6)
4717 * syntactic grouping:                    Language and Grammar.
4718                                                               (line  48)
4719 * syntax error:                          Error Reporting.     (line   6)
4720 * syntax of grammar rules:               Rules.               (line   6)
4721 * terminal symbol:                       Symbols.             (line   6)
4722 * textual location <1>:                  Tracking Locations.  (line   6)
4723 * textual location:                      Locations.           (line   6)
4724 * token <1>:                             Language and Grammar.
4725                                                               (line  48)
4726 * token:                                 C++ Parser Interface.
4727                                                               (line  19)
4728 * token type:                            Symbols.             (line   6)
4729 * token type names, declaring:           Token Decl.          (line   6)
4730 * token, useless:                        Understanding.       (line  49)
4731 * toString on Location:                  Java Location Values.
4732                                                               (line  32)
4733 * tracing the parser:                    Tracing.             (line   6)
4734 * uint:                                  C++ Location Values. (line  12)
4735 * unary operator precedence:             Contextual Precedence.
4736                                                               (line   6)
4737 * unreachable states:                    Unreachable States.  (line   6)
4738 * useless nonterminal:                   Understanding.       (line  49)
4739 * useless rule:                          Understanding.       (line  49)
4740 * useless token:                         Understanding.       (line  49)
4741 * using Bison:                           Stages.              (line   6)
4742 * value type, semantic:                  Value Type.          (line   6)
4743 * value types, declaring:                Union Decl.          (line   6)
4744 * value types, nonterminals, declaring:  Type Decl.           (line   6)
4745 * value, semantic:                       Semantic Values.     (line   6)
4746 * version requirement:                   Require Decl.        (line   6)
4747 * warnings, preventing:                  Expect Decl.         (line   6)
4748 * writing a lexical analyzer:            Rpcalc Lexer.        (line   6)
4749 * YYABORT <1>:                           Java Action Features.
4750                                                               (line  43)
4751 * YYABORT <2>:                           Parser Function.     (line  29)
4752 * YYABORT <3>:                           Table of Symbols.    (line 249)
4753 * YYABORT:                               Action Features.     (line  28)
4754 * YYACCEPT <1>:                          Action Features.     (line  32)
4755 * YYACCEPT <2>:                          Java Action Features.
4756                                                               (line  47)
4757 * YYACCEPT <3>:                          Table of Symbols.    (line 258)
4758 * YYACCEPT:                              Parser Function.     (line  26)
4759 * YYBACKUP <1>:                          Table of Symbols.    (line 266)
4760 * YYBACKUP:                              Action Features.     (line  36)
4761 * yychar <1>:                            Table of Symbols.    (line 270)
4762 * yychar <2>:                            Lookahead.           (line  49)
4763 * yychar <3>:                            Action Features.     (line  69)
4764 * yychar:                                GLR Semantic Actions.
4765                                                               (line  10)
4766 * yyclearin <1>:                         Table of Symbols.    (line 276)
4767 * yyclearin <2>:                         Error Recovery.      (line  99)
4768 * yyclearin <3>:                         GLR Semantic Actions.
4769                                                               (line  18)
4770 * yyclearin:                             Action Features.     (line  76)
4771 * YYDEBUG:                               Table of Symbols.    (line 280)
4772 * yydebug <1>:                           Table of Symbols.    (line 284)
4773 * yydebug:                               Tracing.             (line   6)
4774 * YYDEBUG:                               Enabling Traces.     (line   9)
4775 * YYEMPTY:                               Action Features.     (line  49)
4776 * YYENABLE_NLS:                          Internationalization.
4777                                                               (line  27)
4778 * YYEOF:                                 Action Features.     (line  52)
4779 * yyerrok <1>:                           Error Recovery.      (line  94)
4780 * yyerrok <2>:                           Action Features.     (line  81)
4781 * yyerrok:                               Table of Symbols.    (line 289)
4782 * yyerror:                               Java Action Features.
4783                                                               (line  61)
4784 * YYERROR:                               Java Action Features.
4785                                                               (line  51)
4786 * yyerror:                               Java Action Features.
4787                                                               (line  62)
4788 * YYERROR:                               Table of Symbols.    (line 293)
4789 * yyerror:                               Table of Symbols.    (line 304)
4790 * YYERROR <1>:                           GLR Semantic Actions.
4791                                                               (line  28)
4792 * YYERROR:                               Action Features.     (line  56)
4793 * yyerror:                               Error Reporting.     (line   6)
4794 * yyerror on Lexer:                      Java Scanner Interface.
4795                                                               (line  25)
4796 * YYERROR_VERBOSE:                       Table of Symbols.    (line 308)
4797 * YYFPRINTF <1>:                         Table of Symbols.    (line 316)
4798 * YYFPRINTF:                             Enabling Traces.     (line  36)
4799 * YYINITDEPTH <1>:                       Memory Management.   (line  32)
4800 * YYINITDEPTH:                           Table of Symbols.    (line 319)
4801 * yylex <1>:                             Table of Symbols.    (line 323)
4802 * yylex:                                 Lexical.             (line   6)
4803 * yylex on Lexer:                        Java Scanner Interface.
4804                                                               (line  30)
4805 * yylex on parser:                       C++ Scanner Interface.
4806                                                               (line  12)
4807 * YYLEX_PARAM:                           Table of Symbols.    (line 328)
4808 * yylloc <1>:                            GLR Semantic Actions.
4809                                                               (line  10)
4810 * yylloc <2>:                            Table of Symbols.    (line 334)
4811 * yylloc <3>:                            Action Features.     (line  86)
4812 * yylloc <4>:                            Actions and Locations.
4813                                                               (line  67)
4814 * yylloc <5>:                            Token Locations.     (line   6)
4815 * yylloc:                                Lookahead.           (line  49)
4816 * YYLLOC_DEFAULT:                        Location Default Action.
4817                                                               (line   6)
4818 * YYLTYPE <1>:                           Table of Symbols.    (line 344)
4819 * YYLTYPE:                               Token Locations.     (line  19)
4820 * yylval <1>:                            Lookahead.           (line  49)
4821 * yylval <2>:                            Token Values.        (line   6)
4822 * yylval <3>:                            GLR Semantic Actions.
4823                                                               (line  10)
4824 * yylval <4>:                            Actions.             (line  87)
4825 * yylval <5>:                            Table of Symbols.    (line 348)
4826 * yylval:                                Action Features.     (line  92)
4827 * YYMAXDEPTH <1>:                        Table of Symbols.    (line 356)
4828 * YYMAXDEPTH:                            Memory Management.   (line  14)
4829 * yynerrs <1>:                           Error Reporting.     (line  94)
4830 * yynerrs:                               Table of Symbols.    (line 360)
4831 * yyoutput:                              Printer Decl.        (line  16)
4832 * yyparse <1>:                           Parser Function.     (line   6)
4833 * yyparse <2>:                           Table of Symbols.    (line 366)
4834 * yyparse:                               Parser Function.     (line  13)
4835 * YYPARSE_PARAM:                         Table of Symbols.    (line 404)
4836 * YYParser on YYParser:                  Java Parser Interface.
4837                                                               (line  46)
4838 * YYPRINT <1>:                           Table of Symbols.    (line 370)
4839 * YYPRINT:                               The YYPRINT Macro.   (line  11)
4840 * yypstate_delete <1>:                   Parser Delete Function.
4841                                                               (line  15)
4842 * yypstate_delete:                       Table of Symbols.    (line 375)
4843 * yypstate_new <1>:                      Table of Symbols.    (line 383)
4844 * yypstate_new:                          Parser Create Function.
4845                                                               (line   6)
4846 * yypull_parse <1>:                      Table of Symbols.    (line 390)
4847 * yypull_parse:                          Pull Parser Function.
4848                                                               (line  14)
4849 * yypush_parse <1>:                      Push Parser Function.
4850                                                               (line  15)
4851 * yypush_parse <2>:                      Table of Symbols.    (line 397)
4852 * yypush_parse:                          Push Parser Function.
4853                                                               (line   6)
4854 * YYRECOVERING <1>:                      Table of Symbols.    (line 410)
4855 * YYRECOVERING <2>:                      Error Recovery.      (line 111)
4856 * YYRECOVERING:                          Action Features.     (line  64)
4857 * YYSTACK_USE_ALLOCA:                    Table of Symbols.    (line 415)
4858 * YYSTYPE:                               Table of Symbols.    (line 431)
4859 * | <1>:                                 Table of Symbols.    (line  59)
4860 * |:                                     Rules.               (line  48)
4861
4862