* doc/bison.texinfo: Update the copyright.

ANSIfy and GNUify the examples.
Remove the old menu.
This commit is contained in:
Akim Demaille
2000-09-18 13:24:27 +00:00
parent 0d533154e4
commit 1386333308
2 changed files with 108 additions and 123 deletions

View File

@@ -1,3 +1,9 @@
2000-09-18 Akim Demaille <akim@epita.fr>
* doc/bison.texinfo: Update the copyright.
ANSIfy and GNUify the examples.
Remove the old menu.
2000-09-18 Akim Demaille <akim@epita.fr>
First set of tests: use the `calc' example from the documentation.

View File

@@ -46,7 +46,8 @@ END-INFO-DIR-ENTRY
@ifinfo
This file documents the Bison parser generator.
Copyright (C) 1988, 89, 90, 91, 92, 93, 95, 98, 1999 Free Software Foundation, Inc.
Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999, 2000
Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -86,8 +87,9 @@ instead of in the original English.
@page
@vskip 0pt plus 1filll
Copyright @copyright{} 1988, 89, 90, 91, 92, 93, 95, 98, 1999 Free Software
Foundation
Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998,
1999, 2000
Free Software Foundation, Inc.
@sp 2
Published by the Free Software Foundation @*
@@ -1428,7 +1430,8 @@ Here is the code for the lexical analyzer:
@end group
@group
yylex ()
int
yylex (void)
@{
int c;
@@ -1466,9 +1469,10 @@ kept to the bare minimum. The only requirement is that it call
@example
@group
main ()
int
main (void)
@{
yyparse ();
return yyparse ();
@}
@end group
@end example
@@ -1478,16 +1482,17 @@ main ()
@cindex error reporting routine
When @code{yyparse} detects a syntax error, it calls the error reporting
function @code{yyerror} to print an error message (usually but not always
@code{"parse error"}). It is up to the programmer to supply @code{yyerror}
(@pxref{Interface, ,Parser C-Language Interface}), so here is the definition we will use:
function @code{yyerror} to print an error message (usually but not
always @code{"parse error"}). It is up to the programmer to supply
@code{yyerror} (@pxref{Interface, ,Parser C-Language Interface}), so
here is the definition we will use:
@example
@group
#include <stdio.h>
yyerror (s) /* Called by yyparse on error */
char *s;
void
yyerror (const char *s) /* Called by yyparse on error */
@{
printf ("%s\n", s);
@}
@@ -1851,6 +1856,7 @@ 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
/* Data type for links in the chain of symbols. */
@@ -1885,16 +1891,17 @@ function that initializes the symbol table. Here it is, and
@group
#include <stdio.h>
main ()
int
main (void)
@{
init_table ();
yyparse ();
return yyparse ();
@}
@end group
@group
yyerror (s) /* Called by yyparse on error */
char *s;
void
yyerror (const char *s) /* Called by yyparse on error */
@{
printf ("%s\n", s);
@}
@@ -1907,8 +1914,8 @@ struct init
@end group
@group
struct init arith_fncts[]
= @{
struct init arith_fncts[] =
@{
"sin", sin,
"cos", cos,
"atan", atan,
@@ -1923,7 +1930,9 @@ symrec *sym_table = (symrec *)0;
@end group
@group
init_table () /* puts arithmetic functions in table. */
/* Put arithmetic functions in table. */
void
init_table (void)
@{
int i;
symrec *ptr;
@@ -1948,9 +1957,7 @@ found, a pointer to that symbol is returned; otherwise zero is returned.
@smallexample
symrec *
putsym (sym_name,sym_type)
char *sym_name;
int sym_type;
putsym (char *sym_name, int sym_type)
@{
symrec *ptr;
ptr = (symrec *) malloc (sizeof (symrec));
@@ -1964,8 +1971,7 @@ putsym (sym_name,sym_type)
@}
symrec *
getsym (sym_name)
char *sym_name;
getsym (const char *sym_name)
@{
symrec *ptr;
for (ptr = sym_table; ptr != (symrec *) 0;
@@ -1994,7 +2000,9 @@ operators in @code{yylex}.
@smallexample
@group
#include <ctype.h>
yylex ()
int
yylex (void)
@{
int c;
@@ -3355,7 +3363,8 @@ signifies end-of-input.
Here is an example showing these things:
@example
yylex ()
int
yylex (void)
@{
@dots{}
if (c == EOF) /* Detect end of file. */
@@ -3487,9 +3496,8 @@ shown here, and pass the information back by storing it through those
pointers.
@example
yylex (lvalp, llocp)
YYSTYPE *lvalp;
YYLTYPE *llocp;
int
yylex (YYSTYPE *lvalp, YYLTYPE *llocp)
@{
@dots{}
*lvalp = value; /* Put value onto Bison stack. */
@@ -3620,8 +3628,8 @@ The following definition suffices in simple programs:
@example
@group
yyerror (s)
char *s;
void
yyerror (char *s)
@{
@end group
@group
@@ -4831,10 +4839,7 @@ calculator (@pxref{Mfcalc Decl, ,Declarations for @code{mfcalc}}):
#define YYPRINT(file, type, value) yyprint (file, type, value)
static void
yyprint (file, type, value)
FILE *file;
int type;
YYSTYPE value;
yyprint (FILE *file, int type, YYSTYPE value)
@{
if (type == VAR)
fprintf (file, " %s", value.tptr->name);
@@ -5006,7 +5011,7 @@ would like to direct Bison to use a different copy, setting the
environment variable @code{BISON_SIMPLE} to the path of the file will
cause Bison to use that copy instead.
When the @samp{%semantic_parser} delcaration is used, Bison copies from
When the @samp{%semantic_parser} declaration is used, Bison copies from
a file called @file{bison.hairy} instead. The location of this file can
also be specified or overridden in a similar fashion, with the
@code{BISON_HAIRY} environment variable.
@@ -5160,10 +5165,10 @@ Macro for the data type of semantic values; @code{int} by default.
@xref{Value Type, ,Data Types of Semantic Values}.
@item yychar
External integer variable that contains the integer value of the
current look-ahead token. (In a pure parser, it is a local variable
within @code{yyparse}.) Error-recovery rule actions may examine this
variable. @xref{Action Features, ,Special Features for Use in Actions}.
External integer variable that contains the integer value of the current
look-ahead token. (In a pure parser, it is a local variable within
@code{yyparse}.) Error-recovery rule actions may examine this variable.
@xref{Action Features, ,Special Features for Use in Actions}.
@item yyclearin
Macro used in error-recovery rule actions. It clears the previous
@@ -5181,7 +5186,8 @@ after a parse error. @xref{Error Recovery}.
@item yyerror
User-supplied function to be called by @code{yyparse} on error. The
function receives one argument, a pointer to a character string
containing an error message. @xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}.
containing an error message. @xref{Error Reporting, ,The Error
Reporting Function @code{yyerror}}.
@item yylex
User-supplied lexical analyzer function, called with no arguments
@@ -5194,16 +5200,17 @@ variable within @code{yyparse}, and its address is passed to
@code{yylex}.) @xref{Token Values, ,Semantic Values of Tokens}.
@item yylloc
External variable in which @code{yylex} should place the line and
column numbers associated with a token. (In a pure parser, it is a
local variable within @code{yyparse}, and its address is passed to
External variable in which @code{yylex} should place the line and column
numbers associated with a token. (In a pure parser, it is a local
variable within @code{yyparse}, and its address is passed to
@code{yylex}.) You can ignore this variable if you don't use the
@samp{@@} feature in the grammar actions. @xref{Token Positions, ,Textual Positions of Tokens}.
@samp{@@} feature in the grammar actions. @xref{Token Positions,
,Textual Positions of Tokens}.
@item yynerrs
Global variable which Bison increments each time there is a parse
error. (In a pure parser, it is a local variable within
@code{yyparse}.) @xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}.
Global variable which Bison increments each time there is a parse error.
(In a pure parser, it is a local variable within @code{yyparse}.)
@xref{Error Reporting, ,The Error Reporting Function @code{yyerror}}.
@item yyparse
The parser function produced by Bison; call this function to start
@@ -5448,31 +5455,3 @@ is a token. @xref{Language and Grammar, ,Languages and Context-Free Grammars}.
@contents
@bye
@c old menu
* Introduction::
* Conditions::
* Copying:: The GNU General Public License says
how you can copy and share Bison
Tutorial sections:
* Concepts:: Basic concepts for understanding Bison.
* Examples:: Three simple explained examples of using Bison.
Reference sections:
* Grammar File:: Writing Bison declarations and rules.
* Interface:: C-language interface to the parser function @code{yyparse}.
* Algorithm:: How the Bison parser works at run-time.
* Error Recovery:: Writing rules for error recovery.
* Context Dependency::What to do if your language syntax is too
messy for Bison to handle straightforwardly.
* Debugging:: Debugging Bison parsers that parse wrong.
* Invocation:: How to run Bison (to produce the parser source file).
* Table of Symbols:: All the keywords of the Bison language are explained.
* Glossary:: Basic concepts are explained.
* Index:: Cross-references to the text.