home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / GCC / GCC258_3.LHA / gcc / info / bison.info-4 < prev    next >
Encoding:
GNU Info File  |  1993-12-07  |  50.0 KB  |  1,254 lines

  1. This is Info file bison.info, produced by Makeinfo-1.54 from the input
  2. file /home/gd2/gnu/bison/bison.texinfo.
  3.  
  4.    This file documents the Bison parser generator.
  5.  
  6.    Copyright (C) 1988, 1989, 1990, 1991, 1992 Free Software Foundation,
  7. Inc.
  8.  
  9.    Permission is granted to make and distribute verbatim copies of this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.  
  13.    Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided also
  15. that the sections entitled "GNU General Public License" and "Conditions
  16. for Using Bison" are included exactly as in the original, and provided
  17. that the entire resulting derived work is distributed under the terms
  18. of a permission notice identical to this one.
  19.  
  20.    Permission is granted to copy and distribute translations of this
  21. manual into another language, under the above conditions for modified
  22. versions, except that the sections entitled "GNU General Public
  23. License", "Conditions for Using Bison" and this permission notice may be
  24. included in translations approved by the Free Software Foundation
  25. instead of in the original English.
  26.  
  27. 
  28. File: bison.info,  Node: Mystery Conflicts,  Next: Stack Overflow,  Prev: Reduce/Reduce,  Up: Algorithm
  29.  
  30. Mysterious Reduce/Reduce Conflicts
  31. ==================================
  32.  
  33.    Sometimes reduce/reduce conflicts can occur that don't look
  34. warranted.  Here is an example:
  35.  
  36.      %token ID
  37.      
  38.      %%
  39.      def:    param_spec return_spec ','
  40.              ;
  41.      param_spec:
  42.                   type
  43.              |    name_list ':' type
  44.              ;
  45.      return_spec:
  46.                   type
  47.              |    name ':' type
  48.              ;
  49.      type:        ID
  50.              ;
  51.      name:        ID
  52.              ;
  53.      name_list:
  54.                   name
  55.              |    name ',' name_list
  56.              ;
  57.  
  58.    It would seem that this grammar can be parsed with only a single
  59. token of look-ahead: when a `param_spec' is being read, an `ID' is a
  60. `name' if a comma or colon follows, or a `type' if another `ID'
  61. follows.  In other words, this grammar is LR(1).
  62.  
  63.    However, Bison, like most parser generators, cannot actually handle
  64. all LR(1) grammars.  In this grammar, two contexts, that after an `ID'
  65. at the beginning of a `param_spec' and likewise at the beginning of a
  66. `return_spec', are similar enough that Bison assumes they are the same.
  67. They appear similar because the same set of rules would be active--the
  68. rule for reducing to a `name' and that for reducing to a `type'.  Bison
  69. is unable to determine at that stage of processing that the rules would
  70. require different look-ahead tokens in the two contexts, so it makes a
  71. single parser state for them both.  Combining the two contexts causes a
  72. conflict later.  In parser terminology, this occurrence means that the
  73. grammar is not LALR(1).
  74.  
  75.    In general, it is better to fix deficiencies than to document them.
  76. But this particular deficiency is intrinsically hard to fix; parser
  77. generators that can handle LR(1) grammars are hard to write and tend to
  78. produce parsers that are very large.  In practice, Bison is more useful
  79. as it is now.
  80.  
  81.    When the problem arises, you can often fix it by identifying the two
  82. parser states that are being confused, and adding something to make them
  83. look distinct.  In the above example, adding one rule to `return_spec'
  84. as follows makes the problem go away:
  85.  
  86.      %token BOGUS
  87.      ...
  88.      %%
  89.      ...
  90.      return_spec:
  91.                   type
  92.              |    name ':' type
  93.              /* This rule is never used.  */
  94.              |    ID BOGUS
  95.              ;
  96.  
  97.    This corrects the problem because it introduces the possibility of an
  98. additional active rule in the context after the `ID' at the beginning of
  99. `return_spec'.  This rule is not active in the corresponding context in
  100. a `param_spec', so the two contexts receive distinct parser states.  As
  101. long as the token `BOGUS' is never generated by `yylex', the added rule
  102. cannot alter the way actual input is parsed.
  103.  
  104.    In this particular example, there is another way to solve the
  105. problem: rewrite the rule for `return_spec' to use `ID' directly
  106. instead of via `name'.  This also causes the two confusing contexts to
  107. have different sets of active rules, because the one for `return_spec'
  108. activates the altered rule for `return_spec' rather than the one for
  109. `name'.
  110.  
  111.      param_spec:
  112.                   type
  113.              |    name_list ':' type
  114.              ;
  115.      return_spec:
  116.                   type
  117.              |    ID ':' type
  118.              ;
  119.  
  120. 
  121. File: bison.info,  Node: Stack Overflow,  Prev: Mystery Conflicts,  Up: Algorithm
  122.  
  123. Stack Overflow, and How to Avoid It
  124. ===================================
  125.  
  126.    The Bison parser stack can overflow if too many tokens are shifted
  127. and not reduced.  When this happens, the parser function `yyparse'
  128. returns a nonzero value, pausing only to call `yyerror' to report the
  129. overflow.
  130.  
  131.    By defining the macro `YYMAXDEPTH', you can control how deep the
  132. parser stack can become before a stack overflow occurs.  Define the
  133. macro with a value that is an integer.  This value is the maximum number
  134. of tokens that can be shifted (and not reduced) before overflow.  It
  135. must be a constant expression whose value is known at compile time.
  136.  
  137.    The stack space allowed is not necessarily allocated.  If you
  138. specify a large value for `YYMAXDEPTH', the parser actually allocates a
  139. small stack at first, and then makes it bigger by stages as needed.
  140. This increasing allocation happens automatically and silently.
  141. Therefore, you do not need to make `YYMAXDEPTH' painfully small merely
  142. to save space for ordinary inputs that do not need much stack.
  143.  
  144.    The default value of `YYMAXDEPTH', if you do not define it, is 10000.
  145.  
  146.    You can control how much stack is allocated initially by defining the
  147. macro `YYINITDEPTH'.  This value too must be a compile-time constant
  148. integer.  The default is 200.
  149.  
  150. 
  151. File: bison.info,  Node: Error Recovery,  Next: Context Dependency,  Prev: Algorithm,  Up: Top
  152.  
  153. Error Recovery
  154. **************
  155.  
  156.    It is not usually acceptable to have a program terminate on a parse
  157. error.  For example, a compiler should recover sufficiently to parse the
  158. rest of the input file and check it for errors; a calculator should
  159. accept another expression.
  160.  
  161.    In a simple interactive command parser where each input is one line,
  162. it may be sufficient to allow `yyparse' to return 1 on error and have
  163. the caller ignore the rest of the input line when that happens (and
  164. then call `yyparse' again).  But this is inadequate for a compiler,
  165. because it forgets all the syntactic context leading up to the error.
  166. A syntax error deep within a function in the compiler input should not
  167. cause the compiler to treat the following line like the beginning of a
  168. source file.
  169.  
  170.    You can define how to recover from a syntax error by writing rules to
  171. recognize the special token `error'.  This is a terminal symbol that is
  172. always defined (you need not declare it) and reserved for error
  173. handling.  The Bison parser generates an `error' token whenever a
  174. syntax error happens; if you have provided a rule to recognize this
  175. token in the current context, the parse can continue.
  176.  
  177.    For example:
  178.  
  179.      stmnts:  /* empty string */
  180.              | stmnts '\n'
  181.              | stmnts exp '\n'
  182.              | stmnts error '\n'
  183.  
  184.    The fourth rule in this example says that an error followed by a
  185. newline makes a valid addition to any `stmnts'.
  186.  
  187.    What happens if a syntax error occurs in the middle of an `exp'?  The
  188. error recovery rule, interpreted strictly, applies to the precise
  189. sequence of a `stmnts', an `error' and a newline.  If an error occurs in
  190. the middle of an `exp', there will probably be some additional tokens
  191. and subexpressions on the stack after the last `stmnts', and there will
  192. be tokens to read before the next newline.  So the rule is not
  193. applicable in the ordinary way.
  194.  
  195.    But Bison can force the situation to fit the rule, by discarding
  196. part of the semantic context and part of the input.  First it discards
  197. states and objects from the stack until it gets back to a state in
  198. which the `error' token is acceptable.  (This means that the
  199. subexpressions already parsed are discarded, back to the last complete
  200. `stmnts'.)  At this point the `error' token can be shifted.  Then, if
  201. the old look-ahead token is not acceptable to be shifted next, the
  202. parser reads tokens and discards them until it finds a token which is
  203. acceptable.  In this example, Bison reads and discards input until the
  204. next newline so that the fourth rule can apply.
  205.  
  206.    The choice of error rules in the grammar is a choice of strategies
  207. for error recovery.  A simple and useful strategy is simply to skip the
  208. rest of the current input line or current statement if an error is
  209. detected:
  210.  
  211.      stmnt: error ';'  /* on error, skip until ';' is read */
  212.  
  213.    It is also useful to recover to the matching close-delimiter of an
  214. opening-delimiter that has already been parsed.  Otherwise the
  215. close-delimiter will probably appear to be unmatched, and generate
  216. another, spurious error message:
  217.  
  218.      primary:  '(' expr ')'
  219.              | '(' error ')'
  220.              ...
  221.              ;
  222.  
  223.    Error recovery strategies are necessarily guesses.  When they guess
  224. wrong, one syntax error often leads to another.  In the above example,
  225. the error recovery rule guesses that an error is due to bad input
  226. within one `stmnt'.  Suppose that instead a spurious semicolon is
  227. inserted in the middle of a valid `stmnt'.  After the error recovery
  228. rule recovers from the first error, another syntax error will be found
  229. straightaway, since the text following the spurious semicolon is also
  230. an invalid `stmnt'.
  231.  
  232.    To prevent an outpouring of error messages, the parser will output
  233. no error message for another syntax error that happens shortly after
  234. the first; only after three consecutive input tokens have been
  235. successfully shifted will error messages resume.
  236.  
  237.    Note that rules which accept the `error' token may have actions, just
  238. as any other rules can.
  239.  
  240.    You can make error messages resume immediately by using the macro
  241. `yyerrok' in an action.  If you do this in the error rule's action, no
  242. error messages will be suppressed.  This macro requires no arguments;
  243. `yyerrok;' is a valid C statement.
  244.  
  245.    The previous look-ahead token is reanalyzed immediately after an
  246. error.  If this is unacceptable, then the macro `yyclearin' may be used
  247. to clear this token.  Write the statement `yyclearin;' in the error
  248. rule's action.
  249.  
  250.    For example, suppose that on a parse error, an error handling
  251. routine is called that advances the input stream to some point where
  252. parsing should once again commence.  The next symbol returned by the
  253. lexical scanner is probably correct.  The previous look-ahead token
  254. ought to be discarded with `yyclearin;'.
  255.  
  256.    The macro `YYRECOVERING' stands for an expression that has the value
  257. 1 when the parser is recovering from a syntax error, and 0 the rest of
  258. the time.  A value of 1 indicates that error messages are currently
  259. suppressed for new syntax errors.
  260.  
  261. 
  262. File: bison.info,  Node: Context Dependency,  Next: Debugging,  Prev: Error Recovery,  Up: Top
  263.  
  264. Handling Context Dependencies
  265. *****************************
  266.  
  267.    The Bison paradigm is to parse tokens first, then group them into
  268. larger syntactic units.  In many languages, the meaning of a token is
  269. affected by its context.  Although this violates the Bison paradigm,
  270. certain techniques (known as "kludges") may enable you to write Bison
  271. parsers for such languages.
  272.  
  273. * Menu:
  274.  
  275. * Semantic Tokens::   Token parsing can depend on the semantic context.
  276. * Lexical Tie-ins::   Token parsing can depend on the syntactic context.
  277. * Tie-in Recovery::   Lexical tie-ins have implications for how
  278.                         error recovery rules must be written.
  279.  
  280.    (Actually, "kludge" means any technique that gets its job done but is
  281. neither clean nor robust.)
  282.  
  283. 
  284. File: bison.info,  Node: Semantic Tokens,  Next: Lexical Tie-ins,  Up: Context Dependency
  285.  
  286. Semantic Info in Token Types
  287. ============================
  288.  
  289.    The C language has a context dependency: the way an identifier is
  290. used depends on what its current meaning is.  For example, consider
  291. this:
  292.  
  293.      foo (x);
  294.  
  295.    This looks like a function call statement, but if `foo' is a typedef
  296. name, then this is actually a declaration of `x'.  How can a Bison
  297. parser for C decide how to parse this input?
  298.  
  299.    The method used in GNU C is to have two different token types,
  300. `IDENTIFIER' and `TYPENAME'.  When `yylex' finds an identifier, it
  301. looks up the current declaration of the identifier in order to decide
  302. which token type to return: `TYPENAME' if the identifier is declared as
  303. a typedef, `IDENTIFIER' otherwise.
  304.  
  305.    The grammar rules can then express the context dependency by the
  306. choice of token type to recognize.  `IDENTIFIER' is accepted as an
  307. expression, but `TYPENAME' is not.  `TYPENAME' can start a declaration,
  308. but `IDENTIFIER' cannot.  In contexts where the meaning of the
  309. identifier is *not* significant, such as in declarations that can
  310. shadow a typedef name, either `TYPENAME' or `IDENTIFIER' is
  311. accepted--there is one rule for each of the two token types.
  312.  
  313.    This technique is simple to use if the decision of which kinds of
  314. identifiers to allow is made at a place close to where the identifier is
  315. parsed.  But in C this is not always so: C allows a declaration to
  316. redeclare a typedef name provided an explicit type has been specified
  317. earlier:
  318.  
  319.      typedef int foo, bar, lose;
  320.      static foo (bar);        /* redeclare `bar' as static variable */
  321.      static int foo (lose);   /* redeclare `foo' as function */
  322.  
  323.    Unfortunately, the name being declared is separated from the
  324. declaration construct itself by a complicated syntactic structure--the
  325. "declarator".
  326.  
  327.    As a result, the part of Bison parser for C needs to be duplicated,
  328. with all the nonterminal names changed: once for parsing a declaration
  329. in which a typedef name can be redefined, and once for parsing a
  330. declaration in which that can't be done.  Here is a part of the
  331. duplication, with actions omitted for brevity:
  332.  
  333.      initdcl:
  334.                declarator maybeasm '='
  335.                init
  336.              | declarator maybeasm
  337.              ;
  338.      
  339.      notype_initdcl:
  340.                notype_declarator maybeasm '='
  341.                init
  342.              | notype_declarator maybeasm
  343.              ;
  344.  
  345. Here `initdcl' can redeclare a typedef name, but `notype_initdcl'
  346. cannot.  The distinction between `declarator' and `notype_declarator'
  347. is the same sort of thing.
  348.  
  349.    There is some similarity between this technique and a lexical tie-in
  350. (described next), in that information which alters the lexical analysis
  351. is changed during parsing by other parts of the program.  The
  352. difference is here the information is global, and is used for other
  353. purposes in the program.  A true lexical tie-in has a special-purpose
  354. flag controlled by the syntactic context.
  355.  
  356. 
  357. File: bison.info,  Node: Lexical Tie-ins,  Next: Tie-in Recovery,  Prev: Semantic Tokens,  Up: Context Dependency
  358.  
  359. Lexical Tie-ins
  360. ===============
  361.  
  362.    One way to handle context-dependency is the "lexical tie-in": a flag
  363. which is set by Bison actions, whose purpose is to alter the way tokens
  364. are parsed.
  365.  
  366.    For example, suppose we have a language vaguely like C, but with a
  367. special construct `hex (HEX-EXPR)'.  After the keyword `hex' comes an
  368. expression in parentheses in which all integers are hexadecimal.  In
  369. particular, the token `a1b' must be treated as an integer rather than
  370. as an identifier if it appears in that context.  Here is how you can do
  371. it:
  372.  
  373.      %{
  374.      int hexflag;
  375.      %}
  376.      %%
  377.      ...
  378.      expr:   IDENTIFIER
  379.              | constant
  380.              | HEX '('
  381.                      { hexflag = 1; }
  382.                expr ')'
  383.                      { hexflag = 0;
  384.                         $$ = $4; }
  385.              | expr '+' expr
  386.                      { $$ = make_sum ($1, $3); }
  387.              ...
  388.              ;
  389.      
  390.      constant:
  391.                INTEGER
  392.              | STRING
  393.              ;
  394.  
  395. Here we assume that `yylex' looks at the value of `hexflag'; when it is
  396. nonzero, all integers are parsed in hexadecimal, and tokens starting
  397. with letters are parsed as integers if possible.
  398.  
  399.    The declaration of `hexflag' shown in the C declarations section of
  400. the parser file is needed to make it accessible to the actions (*note
  401. The C Declarations Section: C Declarations.).  You must also write the
  402. code in `yylex' to obey the flag.
  403.  
  404. 
  405. File: bison.info,  Node: Tie-in Recovery,  Prev: Lexical Tie-ins,  Up: Context Dependency
  406.  
  407. Lexical Tie-ins and Error Recovery
  408. ==================================
  409.  
  410.    Lexical tie-ins make strict demands on any error recovery rules you
  411. have.  *Note Error Recovery::.
  412.  
  413.    The reason for this is that the purpose of an error recovery rule is
  414. to abort the parsing of one construct and resume in some larger
  415. construct.  For example, in C-like languages, a typical error recovery
  416. rule is to skip tokens until the next semicolon, and then start a new
  417. statement, like this:
  418.  
  419.      stmt:   expr ';'
  420.              | IF '(' expr ')' stmt { ... }
  421.              ...
  422.              error ';'
  423.                      { hexflag = 0; }
  424.              ;
  425.  
  426.    If there is a syntax error in the middle of a `hex (EXPR)'
  427. construct, this error rule will apply, and then the action for the
  428. completed `hex (EXPR)' will never run.  So `hexflag' would remain set
  429. for the entire rest of the input, or until the next `hex' keyword,
  430. causing identifiers to be misinterpreted as integers.
  431.  
  432.    To avoid this problem the error recovery rule itself clears
  433. `hexflag'.
  434.  
  435.    There may also be an error recovery rule that works within
  436. expressions.  For example, there could be a rule which applies within
  437. parentheses and skips to the close-parenthesis:
  438.  
  439.      expr:   ...
  440.              | '(' expr ')'
  441.                      { $$ = $2; }
  442.              | '(' error ')'
  443.              ...
  444.  
  445.    If this rule acts within the `hex' construct, it is not going to
  446. abort that construct (since it applies to an inner level of parentheses
  447. within the construct).  Therefore, it should not clear the flag: the
  448. rest of the `hex' construct should be parsed with the flag still in
  449. effect.
  450.  
  451.    What if there is an error recovery rule which might abort out of the
  452. `hex' construct or might not, depending on circumstances?  There is no
  453. way you can write the action to determine whether a `hex' construct is
  454. being aborted or not.  So if you are using a lexical tie-in, you had
  455. better make sure your error recovery rules are not of this kind.  Each
  456. rule must be such that you can be sure that it always will, or always
  457. won't, have to clear the flag.
  458.  
  459. 
  460. File: bison.info,  Node: Debugging,  Next: Invocation,  Prev: Context Dependency,  Up: Top
  461.  
  462. Debugging Your Parser
  463. *********************
  464.  
  465.    If a Bison grammar compiles properly but doesn't do what you want
  466. when it runs, the `yydebug' parser-trace feature can help you figure
  467. out why.
  468.  
  469.    To enable compilation of trace facilities, you must define the macro
  470. `YYDEBUG' when you compile the parser.  You could use `-DYYDEBUG=1' as
  471. a compiler option or you could put `#define YYDEBUG 1' in the C
  472. declarations section of the grammar file (*note The C Declarations
  473. Section: C Declarations.).  Alternatively, use the `-t' option when you
  474. run Bison (*note Invoking Bison: Invocation.).  We always define
  475. `YYDEBUG' so that debugging is always possible.
  476.  
  477.    The trace facility uses `stderr', so you must add
  478. `#include <stdio.h>' to the C declarations section unless it is already
  479. there.
  480.  
  481.    Once you have compiled the program with trace facilities, the way to
  482. request a trace is to store a nonzero value in the variable `yydebug'.
  483. You can do this by making the C code do it (in `main', perhaps), or you
  484. can alter the value with a C debugger.
  485.  
  486.    Each step taken by the parser when `yydebug' is nonzero produces a
  487. line or two of trace information, written on `stderr'.  The trace
  488. messages tell you these things:
  489.  
  490.    * Each time the parser calls `yylex', what kind of token was read.
  491.  
  492.    * Each time a token is shifted, the depth and complete contents of
  493.      the state stack (*note Parser States::.).
  494.  
  495.    * Each time a rule is reduced, which rule it is, and the complete
  496.      contents of the state stack afterward.
  497.  
  498.    To make sense of this information, it helps to refer to the listing
  499. file produced by the Bison `-v' option (*note Invoking Bison:
  500. Invocation.).  This file shows the meaning of each state in terms of
  501. positions in various rules, and also what each state will do with each
  502. possible input token.  As you read the successive trace messages, you
  503. can see that the parser is functioning according to its specification
  504. in the listing file.  Eventually you will arrive at the place where
  505. something undesirable happens, and you will see which parts of the
  506. grammar are to blame.
  507.  
  508.    The parser file is a C program and you can use C debuggers on it,
  509. but it's not easy to interpret what it is doing.  The parser function
  510. is a finite-state machine interpreter, and aside from the actions it
  511. executes the same code over and over.  Only the values of variables
  512. show where in the grammar it is working.
  513.  
  514.    The debugging information normally gives the token type of each token
  515. read, but not its semantic value.  You can optionally define a macro
  516. named `YYPRINT' to provide a way to print the value.  If you define
  517. `YYPRINT', it should take three arguments.  The parser will pass a
  518. standard I/O stream, the numeric code for the token type, and the token
  519. value (from `yylval').
  520.  
  521.    Here is an example of `YYPRINT' suitable for the multi-function
  522. calculator (*note Declarations for `mfcalc': Mfcalc Decl.):
  523.  
  524.      #define YYPRINT(file, type, value)   yyprint (file, type, value)
  525.      
  526.      static void
  527.      yyprint (file, type, value)
  528.           FILE *file;
  529.           int type;
  530.           YYSTYPE value;
  531.      {
  532.        if (type == VAR)
  533.          fprintf (file, " %s", value.tptr->name);
  534.        else if (type == NUM)
  535.          fprintf (file, " %d", value.val);
  536.      }
  537.  
  538. 
  539. File: bison.info,  Node: Invocation,  Next: Table of Symbols,  Prev: Debugging,  Up: Top
  540.  
  541. Invoking Bison
  542. **************
  543.  
  544.    The usual way to invoke Bison is as follows:
  545.  
  546.      bison INFILE
  547.  
  548.    Here INFILE is the grammar file name, which usually ends in `.y'.
  549. The parser file's name is made by replacing the `.y' with `.tab.c'.
  550. Thus, the `bison foo.y' filename yields `foo.tab.c', and the `bison
  551. hack/foo.y' filename yields `hack/foo.tab.c'.
  552.  
  553. * Menu:
  554.  
  555. * Bison Options::     All the options described in detail,
  556.             in alphabetical order by short options.
  557. * Option Cross Key::  Alphabetical list of long options.
  558. * VMS Invocation::    Bison command syntax on VMS.
  559.  
  560. 
  561. File: bison.info,  Node: Bison Options,  Next: Option Cross Key,  Up: Invocation
  562.  
  563. Bison Options
  564. =============
  565.  
  566.    Bison supports both traditional single-letter options and mnemonic
  567. long option names.  Long option names are indicated with `--' instead of
  568. `-'.  Abbreviations for option names are allowed as long as they are
  569. unique.  When a long option takes an argument, like `--file-prefix',
  570. connect the option name and the argument with `='.
  571.  
  572.    Here is a list of options that can be used with Bison, alphabetized
  573. by short option.  It is followed by a cross key alphabetized by long
  574. option.
  575.  
  576. `-b FILE-PREFIX'
  577. `--file-prefix=PREFIX'
  578.      Specify a prefix to use for all Bison output file names.  The
  579.      names are chosen as if the input file were named `PREFIX.c'.
  580.  
  581. `-d'
  582. `--defines'
  583.      Write an extra output file containing macro definitions for the
  584.      token type names defined in the grammar and the semantic value type
  585.      `YYSTYPE', as well as a few `extern' variable declarations.
  586.  
  587.      If the parser output file is named `NAME.c' then this file is
  588.      named `NAME.h'.
  589.  
  590.      This output file is essential if you wish to put the definition of
  591.      `yylex' in a separate source file, because `yylex' needs to be
  592.      able to refer to token type codes and the variable `yylval'.
  593.      *Note Semantic Values of Tokens: Token Values.
  594.  
  595. `-l'
  596. `--no-lines'
  597.      Don't put any `#line' preprocessor commands in the parser file.
  598.      Ordinarily Bison puts them in the parser file so that the C
  599.      compiler and debuggers will associate errors with your source
  600.      file, the grammar file.  This option causes them to associate
  601.      errors with the parser file, treating it an independent source
  602.      file in its own right.
  603.  
  604. `-o OUTFILE'
  605. `--output-file=OUTFILE'
  606.      Specify the name OUTFILE for the parser file.
  607.  
  608.      The other output files' names are constructed from OUTFILE as
  609.      described under the `-v' and `-d' switches.
  610.  
  611. `-p PREFIX'
  612. `--name-prefix=PREFIX'
  613.      Rename the external symbols used in the parser so that they start
  614.      with PREFIX instead of `yy'.  The precise list of symbols renamed
  615.      is `yyparse', `yylex', `yyerror', `yylval', `yychar' and `yydebug'.
  616.  
  617.      For example, if you use `-p c', the names become `cparse', `clex',
  618.      and so on.
  619.  
  620.      *Note Multiple Parsers in the Same Program: Multiple Parsers.
  621.  
  622. `-t'
  623. `--debug'
  624.      Output a definition of the macro `YYDEBUG' into the parser file,
  625.      so that the debugging facilities are compiled.  *Note Debugging
  626.      Your Parser: Debugging.
  627.  
  628. `-v'
  629. `--verbose'
  630.      Write an extra output file containing verbose descriptions of the
  631.      parser states and what is done for each type of look-ahead token in
  632.      that state.
  633.  
  634.      This file also describes all the conflicts, both those resolved by
  635.      operator precedence and the unresolved ones.
  636.  
  637.      The file's name is made by removing `.tab.c' or `.c' from the
  638.      parser output file name, and adding `.output' instead.
  639.  
  640.      Therefore, if the input file is `foo.y', then the parser file is
  641.      called `foo.tab.c' by default.  As a consequence, the verbose
  642.      output file is called `foo.output'.
  643.  
  644. `-V'
  645. `--version'
  646.      Print the version number of Bison and exit.
  647.  
  648. `-h'
  649. `--help'
  650.      Print a summary of the command-line options to Bison and exit.
  651.  
  652. `-y'
  653. `--yacc'
  654. `--fixed-output-files'
  655.      Equivalent to `-o y.tab.c'; the parser output file is called
  656.      `y.tab.c', and the other outputs are called `y.output' and
  657.      `y.tab.h'.  The purpose of this switch is to imitate Yacc's output
  658.      file name conventions.  Thus, the following shell script can
  659.      substitute for Yacc:
  660.  
  661.           bison -y $*
  662.  
  663. 
  664. File: bison.info,  Node: Option Cross Key,  Next: VMS Invocation,  Prev: Bison Options,  Up: Invocation
  665.  
  666. Option Cross Key
  667. ================
  668.  
  669.    Here is a list of options, alphabetized by long option, to help you
  670. find the corresponding short option.
  671.  
  672.      --debug                               -t
  673.      --defines                             -d
  674.      --file-prefix=PREFIX                  -b FILE-PREFIX
  675.      --fixed-output-files --yacc           -y
  676.      --help                                -h
  677.      --name-prefix                         -p
  678.      --no-lines                            -l
  679.      --output-file=OUTFILE                 -o OUTFILE
  680.      --verbose                             -v
  681.      --version                             -V
  682.  
  683. 
  684. File: bison.info,  Node: VMS Invocation,  Prev: Option Cross Key,  Up: Invocation
  685.  
  686. Invoking Bison under VMS
  687. ========================
  688.  
  689.    The command line syntax for Bison on VMS is a variant of the usual
  690. Bison command syntax--adapted to fit VMS conventions.
  691.  
  692.    To find the VMS equivalent for any Bison option, start with the long
  693. option, and substitute a `/' for the leading `--', and substitute a `_'
  694. for each `-' in the name of the long option.  For example, the
  695. following invocation under VMS:
  696.  
  697.      bison /debug/name_prefix=bar foo.y
  698.  
  699. is equivalent to the following command under POSIX.
  700.  
  701.      bison --debug --name-prefix=bar foo.y
  702.  
  703.    The VMS file system does not permit filenames such as `foo.tab.c'.
  704. In the above example, the output file would instead be named
  705. `foo_tab.c'.
  706.  
  707. 
  708. File: bison.info,  Node: Table of Symbols,  Next: Glossary,  Prev: Invocation,  Up: Top
  709.  
  710. Bison Symbols
  711. *************
  712.  
  713. `error'
  714.      A token name reserved for error recovery.  This token may be used
  715.      in grammar rules so as to allow the Bison parser to recognize an
  716.      error in the grammar without halting the process.  In effect, a
  717.      sentence containing an error may be recognized as valid.  On a
  718.      parse error, the token `error' becomes the current look-ahead
  719.      token.  Actions corresponding to `error' are then executed, and
  720.      the look-ahead token is reset to the token that originally caused
  721.      the violation.  *Note Error Recovery::.
  722.  
  723. `YYABORT'
  724.      Macro to pretend that an unrecoverable syntax error has occurred,
  725.      by making `yyparse' return 1 immediately.  The error reporting
  726.      function `yyerror' is not called.  *Note The Parser Function
  727.      `yyparse': Parser Function.
  728.  
  729. `YYACCEPT'
  730.      Macro to pretend that a complete utterance of the language has been
  731.      read, by making `yyparse' return 0 immediately.  *Note The Parser
  732.      Function `yyparse': Parser Function.
  733.  
  734. `YYBACKUP'
  735.      Macro to discard a value from the parser stack and fake a
  736.      look-ahead token.  *Note Special Features for Use in Actions:
  737.      Action Features.
  738.  
  739. `YYERROR'
  740.      Macro to pretend that a syntax error has just been detected: call
  741.      `yyerror' and then perform normal error recovery if possible
  742.      (*note Error Recovery::.), or (if recovery is impossible) make
  743.      `yyparse' return 1.  *Note Error Recovery::.
  744.  
  745. `YYERROR_VERBOSE'
  746.      Macro that you define with `#define' in the Bison declarations
  747.      section to request verbose, specific error message strings when
  748.      `yyerror' is called.
  749.  
  750. `YYINITDEPTH'
  751.      Macro for specifying the initial size of the parser stack.  *Note
  752.      Stack Overflow::.
  753.  
  754. `YYLTYPE'
  755.      Macro for the data type of `yylloc'; a structure with four
  756.      members.  *Note Textual Positions of Tokens: Token Positions.
  757.  
  758. `YYMAXDEPTH'
  759.      Macro for specifying the maximum size of the parser stack.  *Note
  760.      Stack Overflow::.
  761.  
  762. `YYRECOVERING'
  763.      Macro whose value indicates whether the parser is recovering from a
  764.      syntax error.  *Note Special Features for Use in Actions: Action
  765.      Features.
  766.  
  767. `YYSTYPE'
  768.      Macro for the data type of semantic values; `int' by default.
  769.      *Note Data Types of Semantic Values: Value Type.
  770.  
  771. `yychar'
  772.      External integer variable that contains the integer value of the
  773.      current look-ahead token.  (In a pure parser, it is a local
  774.      variable within `yyparse'.)  Error-recovery rule actions may
  775.      examine this variable.  *Note Special Features for Use in Actions:
  776.      Action Features.
  777.  
  778. `yyclearin'
  779.      Macro used in error-recovery rule actions.  It clears the previous
  780.      look-ahead token.  *Note Error Recovery::.
  781.  
  782. `yydebug'
  783.      External integer variable set to zero by default.  If `yydebug' is
  784.      given a nonzero value, the parser will output information on input
  785.      symbols and parser action.  *Note Debugging Your Parser: Debugging.
  786.  
  787. `yyerrok'
  788.      Macro to cause parser to recover immediately to its normal mode
  789.      after a parse error.  *Note Error Recovery::.
  790.  
  791. `yyerror'
  792.      User-supplied function to be called by `yyparse' on error.  The
  793.      function receives one argument, a pointer to a character string
  794.      containing an error message.  *Note The Error Reporting Function
  795.      `yyerror': Error Reporting.
  796.  
  797. `yylex'
  798.      User-supplied lexical analyzer function, called with no arguments
  799.      to get the next token.  *Note The Lexical Analyzer Function
  800.      `yylex': Lexical.
  801.  
  802. `yylval'
  803.      External variable in which `yylex' should place the semantic value
  804.      associated with a token.  (In a pure parser, it is a local
  805.      variable within `yyparse', and its address is passed to `yylex'.)
  806.      *Note Semantic Values of Tokens: Token Values.
  807.  
  808. `yylloc'
  809.      External variable in which `yylex' should place the line and
  810.      column numbers associated with a token.  (In a pure parser, it is a
  811.      local variable within `yyparse', and its address is passed to
  812.      `yylex'.)  You can ignore this variable if you don't use the `@'
  813.      feature in the grammar actions.  *Note Textual Positions of
  814.      Tokens: Token Positions.
  815.  
  816. `yynerrs'
  817.      Global variable which Bison increments each time there is a parse
  818.      error.  (In a pure parser, it is a local variable within
  819.      `yyparse'.)  *Note The Error Reporting Function `yyerror': Error
  820.      Reporting.
  821.  
  822. `yyparse'
  823.      The parser function produced by Bison; call this function to start
  824.      parsing.  *Note The Parser Function `yyparse': Parser Function.
  825.  
  826. `%left'
  827.      Bison declaration to assign left associativity to token(s).  *Note
  828.      Operator Precedence: Precedence Decl.
  829.  
  830. `%nonassoc'
  831.      Bison declaration to assign nonassociativity to token(s).  *Note
  832.      Operator Precedence: Precedence Decl.
  833.  
  834. `%prec'
  835.      Bison declaration to assign a precedence to a specific rule.
  836.      *Note Context-Dependent Precedence: Contextual Precedence.
  837.  
  838. `%pure_parser'
  839.      Bison declaration to request a pure (reentrant) parser.  *Note A
  840.      Pure (Reentrant) Parser: Pure Decl.
  841.  
  842. `%right'
  843.      Bison declaration to assign right associativity to token(s).
  844.      *Note Operator Precedence: Precedence Decl.
  845.  
  846. `%start'
  847.      Bison declaration to specify the start symbol.  *Note The
  848.      Start-Symbol: Start Decl.
  849.  
  850. `%token'
  851.      Bison declaration to declare token(s) without specifying
  852.      precedence.  *Note Token Type Names: Token Decl.
  853.  
  854. `%type'
  855.      Bison declaration to declare nonterminals.  *Note Nonterminal
  856.      Symbols: Type Decl.
  857.  
  858. `%union'
  859.      Bison declaration to specify several possible data types for
  860.      semantic values.  *Note The Collection of Value Types: Union Decl.
  861.  
  862.    These are the punctuation and delimiters used in Bison input:
  863.  
  864. `%%'
  865.      Delimiter used to separate the grammar rule section from the Bison
  866.      declarations section or the additional C code section.  *Note The
  867.      Overall Layout of a Bison Grammar: Grammar Layout.
  868.  
  869. `%{ %}'
  870.      All code listed between `%{' and `%}' is copied directly to the
  871.      output file uninterpreted.  Such code forms the "C declarations"
  872.      section of the input file.  *Note Outline of a Bison Grammar:
  873.      Grammar Outline.
  874.  
  875. `/*...*/'
  876.      Comment delimiters, as in C.
  877.  
  878. `:'
  879.      Separates a rule's result from its components.  *Note Syntax of
  880.      Grammar Rules: Rules.
  881.  
  882. `;'
  883.      Terminates a rule.  *Note Syntax of Grammar Rules: Rules.
  884.  
  885. `|'
  886.      Separates alternate rules for the same result nonterminal.  *Note
  887.      Syntax of Grammar Rules: Rules.
  888.  
  889. 
  890. File: bison.info,  Node: Glossary,  Next: Index,  Prev: Table of Symbols,  Up: Top
  891.  
  892. Glossary
  893. ********
  894.  
  895. Backus-Naur Form (BNF)
  896.      Formal method of specifying context-free grammars.  BNF was first
  897.      used in the `ALGOL-60' report, 1963.  *Note Languages and
  898.      Context-Free Grammars: Language and Grammar.
  899.  
  900. Context-free grammars
  901.      Grammars specified as rules that can be applied regardless of
  902.      context.  Thus, if there is a rule which says that an integer can
  903.      be used as an expression, integers are allowed *anywhere* an
  904.      expression is permitted.  *Note Languages and Context-Free
  905.      Grammars: Language and Grammar.
  906.  
  907. Dynamic allocation
  908.      Allocation of memory that occurs during execution, rather than at
  909.      compile time or on entry to a function.
  910.  
  911. Empty string
  912.      Analogous to the empty set in set theory, the empty string is a
  913.      character string of length zero.
  914.  
  915. Finite-state stack machine
  916.      A "machine" that has discrete states in which it is said to exist
  917.      at each instant in time.  As input to the machine is processed, the
  918.      machine moves from state to state as specified by the logic of the
  919.      machine.  In the case of the parser, the input is the language
  920.      being parsed, and the states correspond to various stages in the
  921.      grammar rules.  *Note The Bison Parser Algorithm: Algorithm.
  922.  
  923. Grouping
  924.      A language construct that is (in general) grammatically divisible;
  925.      for example, `expression' or `declaration' in C.  *Note Languages
  926.      and Context-Free Grammars: Language and Grammar.
  927.  
  928. Infix operator
  929.      An arithmetic operator that is placed between the operands on
  930.      which it performs some operation.
  931.  
  932. Input stream
  933.      A continuous flow of data between devices or programs.
  934.  
  935. Language construct
  936.      One of the typical usage schemas of the language.  For example,
  937.      one of the constructs of the C language is the `if' statement.
  938.      *Note Languages and Context-Free Grammars: Language and Grammar.
  939.  
  940. Left associativity
  941.      Operators having left associativity are analyzed from left to
  942.      right: `a+b+c' first computes `a+b' and then combines with `c'.
  943.      *Note Operator Precedence: Precedence.
  944.  
  945. Left recursion
  946.      A rule whose result symbol is also its first component symbol; for
  947.      example, `expseq1 : expseq1 ',' exp;'.  *Note Recursive Rules:
  948.      Recursion.
  949.  
  950. Left-to-right parsing
  951.      Parsing a sentence of a language by analyzing it token by token
  952.      from left to right.  *Note The Bison Parser Algorithm: Algorithm.
  953.  
  954. Lexical analyzer (scanner)
  955.      A function that reads an input stream and returns tokens one by
  956.      one.  *Note The Lexical Analyzer Function `yylex': Lexical.
  957.  
  958. Lexical tie-in
  959.      A flag, set by actions in the grammar rules, which alters the way
  960.      tokens are parsed.  *Note Lexical Tie-ins::.
  961.  
  962. Look-ahead token
  963.      A token already read but not yet shifted.  *Note Look-Ahead
  964.      Tokens: Look-Ahead.
  965.  
  966. LALR(1)
  967.      The class of context-free grammars that Bison (like most other
  968.      parser generators) can handle; a subset of LR(1).  *Note
  969.      Mysterious Reduce/Reduce Conflicts: Mystery Conflicts.
  970.  
  971. LR(1)
  972.      The class of context-free grammars in which at most one token of
  973.      look-ahead is needed to disambiguate the parsing of any piece of
  974.      input.
  975.  
  976. Nonterminal symbol
  977.      A grammar symbol standing for a grammatical construct that can be
  978.      expressed through rules in terms of smaller constructs; in other
  979.      words, a construct that is not a token.  *Note Symbols::.
  980.  
  981. Parse error
  982.      An error encountered during parsing of an input stream due to
  983.      invalid syntax.  *Note Error Recovery::.
  984.  
  985. Parser
  986.      A function that recognizes valid sentences of a language by
  987.      analyzing the syntax structure of a set of tokens passed to it
  988.      from a lexical analyzer.
  989.  
  990. Postfix operator
  991.      An arithmetic operator that is placed after the operands upon
  992.      which it performs some operation.
  993.  
  994. Reduction
  995.      Replacing a string of nonterminals and/or terminals with a single
  996.      nonterminal, according to a grammar rule.  *Note The Bison Parser
  997.      Algorithm: Algorithm.
  998.  
  999. Reentrant
  1000.      A reentrant subprogram is a subprogram which can be in invoked any
  1001.      number of times in parallel, without interference between the
  1002.      various invocations.  *Note A Pure (Reentrant) Parser: Pure Decl.
  1003.  
  1004. Reverse polish notation
  1005.      A language in which all operators are postfix operators.
  1006.  
  1007. Right recursion
  1008.      A rule whose result symbol is also its last component symbol; for
  1009.      example, `expseq1: exp ',' expseq1;'.  *Note Recursive Rules:
  1010.      Recursion.
  1011.  
  1012. Semantics
  1013.      In computer languages, the semantics are specified by the actions
  1014.      taken for each instance of the language, i.e., the meaning of each
  1015.      statement.  *Note Defining Language Semantics: Semantics.
  1016.  
  1017. Shift
  1018.      A parser is said to shift when it makes the choice of analyzing
  1019.      further input from the stream rather than reducing immediately some
  1020.      already-recognized rule.  *Note The Bison Parser Algorithm:
  1021.      Algorithm.
  1022.  
  1023. Single-character literal
  1024.      A single character that is recognized and interpreted as is.
  1025.      *Note From Formal Rules to Bison Input: Grammar in Bison.
  1026.  
  1027. Start symbol
  1028.      The nonterminal symbol that stands for a complete valid utterance
  1029.      in the language being parsed.  The start symbol is usually listed
  1030.      as the first nonterminal symbol in a language specification.
  1031.      *Note The Start-Symbol: Start Decl.
  1032.  
  1033. Symbol table
  1034.      A data structure where symbol names and associated data are stored
  1035.      during parsing to allow for recognition and use of existing
  1036.      information in repeated uses of a symbol.  *Note Multi-function
  1037.      Calc::.
  1038.  
  1039. Token
  1040.      A basic, grammatically indivisible unit of a language.  The symbol
  1041.      that describes a token in the grammar is a terminal symbol.  The
  1042.      input of the Bison parser is a stream of tokens which comes from
  1043.      the lexical analyzer.  *Note Symbols::.
  1044.  
  1045. Terminal symbol
  1046.      A grammar symbol that has no rules in the grammar and therefore is
  1047.      grammatically indivisible.  The piece of text it represents is a
  1048.      token.  *Note Languages and Context-Free Grammars: Language and
  1049.      Grammar.
  1050.  
  1051. 
  1052. File: bison.info,  Node: Index,  Prev: Glossary,  Up: Top
  1053.  
  1054. Index
  1055. *****
  1056.  
  1057. * Menu:
  1058.  
  1059. * $$:                                   Actions.
  1060. * $N:                                   Actions.
  1061. * %expect:                              Expect Decl.
  1062. * %left:                                Using Precedence.
  1063. * %nonassoc:                            Using Precedence.
  1064. * %prec:                                Contextual Precedence.
  1065. * %pure_parser:                         Pure Decl.
  1066. * %right:                               Using Precedence.
  1067. * %start:                               Start Decl.
  1068. * %token:                               Token Decl.
  1069. * %type:                                Type Decl.
  1070. * %union:                               Union Decl.
  1071. * @N:                                   Action Features.
  1072. * calc:                                 Infix Calc.
  1073. * else, dangling:                       Shift/Reduce.
  1074. * mfcalc:                               Multi-function Calc.
  1075. * rpcalc:                               RPN Calc.
  1076. * action:                               Actions.
  1077. * action data types:                    Action Types.
  1078. * action features summary:              Action Features.
  1079. * actions in mid-rule:                  Mid-Rule Actions.
  1080. * actions, semantic:                    Semantic Actions.
  1081. * additional C code section:            C Code.
  1082. * algorithm of parser:                  Algorithm.
  1083. * associativity:                        Why Precedence.
  1084. * Backus-Naur form:                     Language and Grammar.
  1085. * Bison declaration summary:            Decl Summary.
  1086. * Bison declarations:                   Declarations.
  1087. * Bison declarations (introduction):    Bison Declarations.
  1088. * Bison grammar:                        Grammar in Bison.
  1089. * Bison invocation:                     Invocation.
  1090. * Bison parser:                         Bison Parser.
  1091. * Bison parser algorithm:               Algorithm.
  1092. * Bison symbols, table of:              Table of Symbols.
  1093. * Bison utility:                        Bison Parser.
  1094. * BNF:                                  Language and Grammar.
  1095. * C code, section for additional:       C Code.
  1096. * C declarations section:               C Declarations.
  1097. * C-language interface:                 Interface.
  1098. * calculator, infix notation:           Infix Calc.
  1099. * calculator, multi-function:           Multi-function Calc.
  1100. * calculator, simple:                   RPN Calc.
  1101. * character token:                      Symbols.
  1102. * compiling the parser:                 Rpcalc Compile.
  1103. * conflicts:                            Shift/Reduce.
  1104. * conflicts, reduce/reduce:             Reduce/Reduce.
  1105. * conflicts, suppressing warnings of:   Expect Decl.
  1106. * context-dependent precedence:         Contextual Precedence.
  1107. * context-free grammar:                 Language and Grammar.
  1108. * controlling function:                 Rpcalc Main.
  1109. * dangling else:                        Shift/Reduce.
  1110. * data types in actions:                Action Types.
  1111. * data types of semantic values:        Value Type.
  1112. * debugging:                            Debugging.
  1113. * declaration summary:                  Decl Summary.
  1114. * declarations, Bison:                  Declarations.
  1115. * declarations, Bison (introduction):   Bison Declarations.
  1116. * declarations, C:                      C Declarations.
  1117. * declaring operator precedence:        Precedence Decl.
  1118. * declaring the start symbol:           Start Decl.
  1119. * declaring token type names:           Token Decl.
  1120. * declaring value types:                Union Decl.
  1121. * declaring value types, nonterminals:  Type Decl.
  1122. * default action:                       Actions.
  1123. * default data type:                    Value Type.
  1124. * default stack limit:                  Stack Overflow.
  1125. * default start symbol:                 Start Decl.
  1126. * defining language semantics:          Semantics.
  1127. * error:                                Error Recovery.
  1128. * error recovery:                       Error Recovery.
  1129. * error recovery, simple:               Simple Error Recovery.
  1130. * error reporting function:             Error Reporting.
  1131. * error reporting routine:              Rpcalc Error.
  1132. * examples, simple:                     Examples.
  1133. * exercises:                            Exercises.
  1134. * file format:                          Grammar Layout.
  1135. * finite-state machine:                 Parser States.
  1136. * formal grammar:                       Grammar in Bison.
  1137. * format of grammar file:               Grammar Layout.
  1138. * glossary:                             Glossary.
  1139. * grammar file:                         Grammar Layout.
  1140. * grammar rule syntax:                  Rules.
  1141. * grammar rules section:                Grammar Rules.
  1142. * grammar, Bison:                       Grammar in Bison.
  1143. * grammar, context-free:                Language and Grammar.
  1144. * grouping, syntactic:                  Language and Grammar.
  1145. * infix notation calculator:            Infix Calc.
  1146. * interface:                            Interface.
  1147. * introduction:                         Introduction.
  1148. * invoking Bison:                       Invocation.
  1149. * invoking Bison under VMS:             VMS Invocation.
  1150. * LALR(1):                              Mystery Conflicts.
  1151. * language semantics, defining:         Semantics.
  1152. * layout of Bison grammar:              Grammar Layout.
  1153. * left recursion:                       Recursion.
  1154. * lexical analyzer:                     Lexical.
  1155. * lexical analyzer, purpose:            Bison Parser.
  1156. * lexical analyzer, writing:            Rpcalc Lexer.
  1157. * lexical tie-in:                       Lexical Tie-ins.
  1158. * literal token:                        Symbols.
  1159. * look-ahead token:                     Look-Ahead.
  1160. * LR(1):                                Mystery Conflicts.
  1161. * main function in simple example:      Rpcalc Main.
  1162. * mid-rule actions:                     Mid-Rule Actions.
  1163. * multi-function calculator:            Multi-function Calc.
  1164. * mutual recursion:                     Recursion.
  1165. * nonterminal symbol:                   Symbols.
  1166. * operator precedence:                  Precedence.
  1167. * operator precedence, declaring:       Precedence Decl.
  1168. * options for invoking Bison:           Invocation.
  1169. * overflow of parser stack:             Stack Overflow.
  1170. * parse error:                          Error Reporting.
  1171. * parser:                               Bison Parser.
  1172. * parser stack:                         Algorithm.
  1173. * parser stack overflow:                Stack Overflow.
  1174. * parser state:                         Parser States.
  1175. * polish notation calculator:           RPN Calc.
  1176. * precedence declarations:              Precedence Decl.
  1177. * precedence of operators:              Precedence.
  1178. * precedence, context-dependent:        Contextual Precedence.
  1179. * precedence, unary operator:           Contextual Precedence.
  1180. * preventing warnings about conflicts:  Expect Decl.
  1181. * pure parser:                          Pure Decl.
  1182. * recovery from errors:                 Error Recovery.
  1183. * recursive rule:                       Recursion.
  1184. * reduce/reduce conflict:               Reduce/Reduce.
  1185. * reduction:                            Algorithm.
  1186. * reentrant parser:                     Pure Decl.
  1187. * reverse polish notation:              RPN Calc.
  1188. * right recursion:                      Recursion.
  1189. * rule syntax:                          Rules.
  1190. * rules section for grammar:            Grammar Rules.
  1191. * running Bison (introduction):         Rpcalc Gen.
  1192. * semantic actions:                     Semantic Actions.
  1193. * semantic value:                       Semantic Values.
  1194. * semantic value type:                  Value Type.
  1195. * shift/reduce conflicts:               Shift/Reduce.
  1196. * shifting:                             Algorithm.
  1197. * simple examples:                      Examples.
  1198. * single-character literal:             Symbols.
  1199. * stack overflow:                       Stack Overflow.
  1200. * stack, parser:                        Algorithm.
  1201. * stages in using Bison:                Stages.
  1202. * start symbol:                         Language and Grammar.
  1203. * start symbol, declaring:              Start Decl.
  1204. * state (of parser):                    Parser States.
  1205. * summary, action features:             Action Features.
  1206. * summary, Bison declaration:           Decl Summary.
  1207. * suppressing conflict warnings:        Expect Decl.
  1208. * symbol:                               Symbols.
  1209. * symbol table example:                 Mfcalc Symtab.
  1210. * symbols (abstract):                   Language and Grammar.
  1211. * symbols in Bison, table of:           Table of Symbols.
  1212. * syntactic grouping:                   Language and Grammar.
  1213. * syntax error:                         Error Reporting.
  1214. * syntax of grammar rules:              Rules.
  1215. * terminal symbol:                      Symbols.
  1216. * token:                                Language and Grammar.
  1217. * token type:                           Symbols.
  1218. * token type names, declaring:          Token Decl.
  1219. * tracing the parser:                   Debugging.
  1220. * unary operator precedence:            Contextual Precedence.
  1221. * using Bison:                          Stages.
  1222. * value type, semantic:                 Value Type.
  1223. * value types, declaring:               Union Decl.
  1224. * value types, nonterminals, declaring: Type Decl.
  1225. * value, semantic:                      Semantic Values.
  1226. * VMS:                                  VMS Invocation.
  1227. * warnings, preventing:                 Expect Decl.
  1228. * writing a lexical analyzer:           Rpcalc Lexer.
  1229. * YYABORT:                              Parser Function.
  1230. * YYACCEPT:                             Parser Function.
  1231. * YYBACKUP:                             Action Features.
  1232. * yychar:                               Look-Ahead.
  1233. * yyclearin:                            Error Recovery.
  1234. * YYDEBUG:                              Debugging.
  1235. * yydebug:                              Debugging.
  1236. * YYEMPTY:                              Action Features.
  1237. * yyerrok:                              Error Recovery.
  1238. * YYERROR:                              Action Features.
  1239. * yyerror:                              Error Reporting.
  1240. * YYERROR_VERBOSE:                      Error Reporting.
  1241. * YYINITDEPTH:                          Stack Overflow.
  1242. * yylex:                                Lexical.
  1243. * yylloc:                               Token Positions.
  1244. * YYLTYPE:                              Token Positions.
  1245. * yylval:                               Token Values.
  1246. * YYMAXDEPTH:                           Stack Overflow.
  1247. * yynerrs:                              Error Reporting.
  1248. * yyparse:                              Parser Function.
  1249. * YYPRINT:                              Debugging.
  1250. * YYRECOVERING:                         Error Recovery.
  1251. * |:                                    Rules.
  1252.  
  1253.  
  1254.