]> git.saurik.com Git - bison.git/blobdiff - doc/bison.texinfo
Add.
[bison.git] / doc / bison.texinfo
index da8508211a64dc52a3eab90c19767b85710ab054..29ce7b692e9a61b55460a7d3acc5934644b9cdf8 100644 (file)
@@ -1859,17 +1859,20 @@ The symbol table itself consists of a linked list of records.  Its
 definition, which is kept in the header @file{calc.h}, is as follows.  It
 provides for either functions or variables to be placed in the table.
 
-@c FIXME: ANSIfy the prototypes for FNCTPTR etc.
 @smallexample
 @group
+/* Fonctions type.                                   */
+typedef double (*func_t) (double);
+
 /* Data type for links in the chain of symbols.      */
 struct symrec
 @{
   char *name;  /* name of symbol                     */
   int type;    /* type of symbol: either VAR or FNCT */
-  union @{
-    double var;           /* value of a VAR          */
-    double (*fnctptr)();  /* value of a FNCT         */
+  union
+  @{
+    double var;                  /* value of a VAR   */
+    func_t fnctptr;              /* value of a FNCT  */
   @} value;
   struct symrec *next;    /* link field              */
 @};
@@ -1881,8 +1884,8 @@ typedef struct symrec symrec;
 /* The symbol table: a chain of `struct symrec'.     */
 extern symrec *sym_table;
 
-symrec *putsym ();
-symrec *getsym ();
+symrec *putsym (const char *, func_t);
+symrec *getsym (const char *);
 @end group
 @end smallexample
 
@@ -1912,24 +1915,24 @@ yyerror (const char *s)  /* Called by yyparse on error */
 struct init
 @{
   char *fname;
-  double (*fnct)();
+  double (*fnct)(double);
 @};
 @end group
 
 @group
 struct init arith_fncts[] =
 @{
-  "sin", sin,
-  "cos", cos,
+  "sin",  sin,
+  "cos",  cos,
   "atan", atan,
-  "ln", log,
-  "exp", exp,
+  "ln",   log,
+  "exp",  exp,
   "sqrt", sqrt,
   0, 0
 @};
 
 /* The symbol table: a chain of `struct symrec'.  */
-symrec *sym_table = (symrec *)0;
+symrec *sym_table = (symrec *) 0;
 @end group
 
 @group
@@ -3189,6 +3192,11 @@ Start-Symbol}).
 Declare the expected number of shift-reduce conflicts
 (@pxref{Expect Decl, ,Suppressing Conflict Warnings}).
 
+@item %yacc
+@itemx %fixed_output_files
+Pretend the option @option{--yacc} was given, i.e., imitate Yacc,
+including its naming conventions.  @xref{Bison Options}, for more.
+
 @item %locations
 Generate the code processing the locations (@pxref{Action Features,
 ,Special Features for Use in Actions}).  This mode is enabled as soon as
@@ -3200,6 +3208,15 @@ accurate parse error messages.
 Request a pure (reentrant) parser program (@pxref{Pure Decl, ,A Pure
 (Reentrant) Parser}).
 
+@item %no_parser
+Do not include any C code in the parser file; generate tables only.  The
+parser file contains just @code{#define} directives and static variable
+declarations.
+
+This option also tells Bison to write the C code for the grammar actions
+into a file named @file{@var{filename}.act}, in the form of a
+brace-surrounded body fit for a @code{switch} statement.
+
 @item %no_lines
 Don't generate any @code{#line} preprocessor commands in the parser
 file.  Ordinarily Bison writes these commands in the parser file so that
@@ -3208,12 +3225,38 @@ your source file (the grammar file).  This directive causes them to
 associate errors with the parser file, treating it an independent source
 file in its own right.
 
-@item %raw
-The output file @file{@var{name}.h} normally defines the tokens with
-Yacc-compatible token numbers.  If this option is specified, the
-internal Bison numbers are used instead.  (Yacc-compatible numbers start
-at 257 except for single-character tokens; Bison assigns token numbers
-sequentially for all tokens starting at 3.)
+@item %debug
+Output a definition of the macro @code{YYDEBUG} into the parser file, so
+that the debugging facilities are compiled.  @xref{Debugging, ,Debugging
+Your Parser}.
+
+@item %defines
+Write an extra output file containing macro definitions for the token
+type names defined in the grammar and the semantic value type
+@code{YYSTYPE}, as well as a few @code{extern} variable declarations.
+
+If the parser output file is named @file{@var{name}.c} then this file
+is named @file{@var{name}.h}.@refill
+
+This output file is essential if you wish to put the definition of
+@code{yylex} in a separate source file, because @code{yylex} needs to
+be able to refer to token type codes and the variable
+@code{yylval}.  @xref{Token Values, ,Semantic Values of Tokens}.@refill
+
+@item %verbose
+Write an extra output file containing verbose descriptions of the
+parser states and what is done for each type of look-ahead token in
+that state.
+
+This file also describes all the conflicts, both those resolved by
+operator precedence and the unresolved ones.
+
+The file's name is made by removing @samp{.tab.c} or @samp{.c} from
+the parser output file name, and adding @samp{.output} instead.@refill
+
+Therefore, if the input file is @file{foo.y}, then the parser file is
+called @file{foo.tab.c} by default.  As a consequence, the verbose
+output file is called @file{foo.output}.@refill
 
 @item %token_table
 Generate an array of token names in the parser file.  The name of the
@@ -4937,10 +4980,16 @@ bison -y $*
 Tuning the parser:
 
 @table @option
+@item -S @var{file}
+@itemx --skeleton=@var{file}
+Specify the skeleton to use.  You probably don't need this option unless
+you are developing Bison.
+
 @item -t
 @itemx --debug
-Output a definition of the macro @code{YYDEBUG} into the parser file,
-so that the debugging facilities are compiled.  @xref{Debugging, ,Debugging Your Parser}.
+Output a definition of the macro @code{YYDEBUG} into the parser file, so
+that the debugging facilities are compiled.  @xref{Debugging, ,Debugging
+Your Parser}.
 
 @item --locations
 Pretend that @code{%locactions} was specified.  @xref{Decl Summary}.
@@ -4967,17 +5016,7 @@ parser file, treating it as an independent source file in its own right.
 
 @item -n
 @itemx --no-parser
-Do not include any C code in the parser file; generate tables only.  The
-parser file contains just @code{#define} directives and static variable
-declarations.
-
-This option also tells Bison to write the C code for the grammar actions
-into a file named @file{@var{filename}.act}, in the form of a
-brace-surrounded body fit for a @code{switch} statement.
-
-@item -r
-@itemx --raw
-Pretend that @code{%raw} was specified.  @xref{Decl Summary}.
+Pretend that @code{%no_parser} was specified.  @xref{Decl Summary}.
 
 @item -k
 @itemx --token-table
@@ -4990,17 +5029,10 @@ Adjust the output:
 @table @option
 @item -d
 @itemx --defines
-Write an extra output file containing macro definitions for the token
-type names defined in the grammar and the semantic value type
-@code{YYSTYPE}, as well as a few @code{extern} variable declarations.
-
-If the parser output file is named @file{@var{name}.c} then this file
-is named @file{@var{name}.h}.@refill
-
-This output file is essential if you wish to put the definition of
-@code{yylex} in a separate source file, because @code{yylex} needs to
-be able to refer to token type codes and the variable
-@code{yylval}.  @xref{Token Values, ,Semantic Values of Tokens}.@refill
+Pretend that @code{%verbose} was specified, i.e., write an extra output
+file containing macro definitions for the token type names defined in
+the grammar and the semantic value type @code{YYSTYPE}, as well as a few
+@code{extern} variable declarations.  @xref{Decl Summary}.
 
 @item -b @var{file-prefix}
 @itemx --file-prefix=@var{prefix}
@@ -5009,19 +5041,9 @@ chosen as if the input file were named @file{@var{prefix}.c}.
 
 @item -v
 @itemx --verbose
-Write an extra output file containing verbose descriptions of the
-parser states and what is done for each type of look-ahead token in
-that state.
-
-This file also describes all the conflicts, both those resolved by
-operator precedence and the unresolved ones.
-
-The file's name is made by removing @samp{.tab.c} or @samp{.c} from
-the parser output file name, and adding @samp{.output} instead.@refill
-
-Therefore, if the input file is @file{foo.y}, then the parser file is
-called @file{foo.tab.c} by default.  As a consequence, the verbose
-output file is called @file{foo.output}.@refill
+Pretend that @code{%verbose} was specified, i.e, write an extra output
+file containing verbose descriptions of the grammar and
+parser. @xref{Decl Summary}, for more.
 
 @item -o @var{outfile}
 @itemx --output-file=@var{outfile}
@@ -5075,7 +5097,6 @@ the corresponding short option.
 \line{ --no-lines \leaderfill -l}
 \line{ --no-parser \leaderfill -n}
 \line{ --output-file \leaderfill -o}
-\line{ --raw \leaderfill -r}
 \line{ --token-table \leaderfill -k}
 \line{ --verbose \leaderfill -v}
 \line{ --version \leaderfill -V}
@@ -5094,7 +5115,6 @@ the corresponding short option.
 --no-lines                            -l
 --no-parser                           -n
 --output-file=@var{outfile}                 -o @var{outfile}
---raw                                 -r
 --token-table                         -k
 --verbose                             -v
 --version                             -V
@@ -5255,6 +5275,13 @@ Global variable which Bison increments each time there is a parse error.
 The parser function produced by Bison; call this function to start
 parsing.  @xref{Parser Function, ,The Parser Function @code{yyparse}}.
 
+@item %debug
+Equip the parser for debugging.  @xref{Decl Summary}.
+
+@item %defines
+Bison declaration to create a header file meant for the scanner.
+@xref{Decl Summary}.
+
 @item %left
 Bison declaration to assign left associativity to token(s).
 @xref{Precedence Decl, ,Operator Precedence}.
@@ -5275,11 +5302,6 @@ Bison declaration to assign a precedence to a specific rule.
 Bison declaration to request a pure (reentrant) parser.
 @xref{Pure Decl, ,A Pure (Reentrant) Parser}.
 
-@item %raw
-Bison declaration to use Bison internal token code numbers in token
-tables instead of the usual Yacc-compatible token code numbers.
-@xref{Decl Summary}.
-
 @item %right
 Bison declaration to assign right associativity to token(s).
 @xref{Precedence Decl, ,Operator Precedence}.