X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/62ab6972e8338613d09562166b4b4fa5f48693a4..dd3127cf7a8534b1689d19452e310138d8db784f:/doc/bison.info-1 diff --git a/doc/bison.info-1 b/doc/bison.info-1 index 37f759cc..341a38ed 100644 --- a/doc/bison.info-1 +++ b/doc/bison.info-1 @@ -1,5 +1,5 @@ -Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0 à -partir bison.texinfo. +Ceci est le fichier Info bison.info, produit par Makeinfo version 4.0b +à partir bison.texinfo. START-INFO-DIR-ENTRY * bison: (bison). GNU Project parser generator (yacc replacement). @@ -8,7 +8,7 @@ END-INFO-DIR-ENTRY This file documents the Bison parser generator. Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1995, 1998, 1999, -2000 Free Software Foundation, Inc. +2000, 2001 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -31,7 +31,7 @@ instead of in the original English.  File: bison.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) - This manual documents version 1.28a of Bison. + This manual documents version 1.28c of Bison. * Menu: @@ -55,6 +55,7 @@ Reference sections: * 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. +* Copying This Manual:: License for copying this manual. * Index:: Cross-references to the text. --- The Detailed Node Listing --- @@ -195,6 +196,10 @@ Invoking Bison * Option Cross Key:: Alphabetical list of long options. * VMS Invocation:: Bison command syntax on VMS. +Copying This Manual + +* GNU Free Documentation License:: License for copying this manual. +  File: bison.info, Node: Introduction, Next: Conditions, Prev: Top, Up: Top @@ -223,7 +228,7 @@ Bison in detail. it Yacc-compatible. Wilfred Hansen of Carnegie Mellon University added multi-character string literals and other features. - This edition corresponds to version 1.28a of Bison. + This edition corresponds to version 1.28c of Bison.  File: bison.info, Node: Conditions, Next: Copying, Prev: Introduction, Up: Top @@ -265,7 +270,7 @@ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -322,7 +327,6 @@ patent must be licensed for everyone's free use or not licensed at all. modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", @@ -554,8 +558,8 @@ modification follow. END OF TERMS AND CONDITIONS -How to Apply These Terms to Your New Programs -============================================= +Appendix: How to Apply These Terms to Your New Programs +======================================================= If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -568,7 +572,7 @@ convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. - Copyright (C) 19YY NAME OF AUTHOR + Copyright (C) YYYY NAME OF AUTHOR This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -582,8 +586,7 @@ the "copyright" line and a pointer to where the full notice is found. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Also add information on how to contact you by electronic and paper mail. @@ -592,8 +595,7 @@ mail. this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details - type `show w'. + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. @@ -639,6 +641,7 @@ carefully. a semantic value (the value of an integer, the name of an identifier, etc.). * Semantic Actions:: Each rule can have an action containing C code. +* Locations Overview:: Tracking Locations. * Bison Parser:: What are Bison's input and output, how is the output used? * Stages:: Stages in writing and running Bison grammars. @@ -830,7 +833,7 @@ programming language, an expression typically has a semantic value that is a tree structure describing the meaning of the expression.  -File: bison.info, Node: Semantic Actions, Next: Bison Parser, Prev: Semantic Values, Up: Concepts +File: bison.info, Node: Semantic Actions, Next: Locations Overview, Prev: Semantic Values, Up: Concepts Semantic Actions ================ @@ -859,7 +862,38 @@ The action says how to produce the semantic value of the sum expression from the values of the two subexpressions.  -File: bison.info, Node: Bison Parser, Next: Stages, Prev: Semantic Actions, Up: Concepts +File: bison.info, Node: Locations Overview, Next: Bison Parser, Prev: Semantic Actions, Up: Concepts + +Locations +========= + + Many applications, like interpreters or compilers, have to produce +verbose and useful error messages. To achieve this, one must be able to +keep track of the "textual position", or "location", of each syntactic +construct. Bison provides a mechanism for handling these locations. + + Each token has a semantic value. In a similar fashion, each token +has an associated location, but the type of locations is the same for +all tokens and groupings. Moreover, the output parser is equipped with +a default data structure for storing locations (*note Locations::, for +more details). + + Like semantic values, locations can be reached in actions using a +dedicated set of constructs. In the example above, the location of the +whole grouping is `@$', while the locations of the subexpressions are +`@1' and `@3'. + + When a rule is matched, a default action is used to compute the +semantic value of its left hand side (*note Actions::). In the same +way, another default action is used for locations. However, the action +for locations is general enough for most cases, meaning there is +usually no need to describe for each rule how `@$' should be formed. +When building a new location for a given grouping, the default behavior +of the output parser is to take the beginning of the first symbol, and +the end of the last symbol. + + +File: bison.info, Node: Bison Parser, Next: Stages, Prev: Locations Overview, Up: Concepts Bison Output: the Parser File ============================= @@ -1029,45 +1063,3 @@ extension is a convention used for Bison input files. * Gen: Rpcalc Gen. Running Bison on the grammar file. * Comp: Rpcalc Compile. Run the C compiler on the output code. - -File: bison.info, Node: Rpcalc Decls, Next: Rpcalc Rules, Up: RPN Calc - -Declarations for `rpcalc' -------------------------- - - Here are the C and Bison declarations for the reverse polish notation -calculator. As in C, comments are placed between `/*...*/'. - - /* Reverse polish notation calculator. */ - - %{ - #define YYSTYPE double - #include - %} - - %token NUM - - %% /* Grammar rules and actions follow */ - - The C declarations section (*note The C Declarations Section: C -Declarations.) contains two preprocessor directives. - - The `#define' directive defines the macro `YYSTYPE', thus specifying -the C data type for semantic values of both tokens and groupings (*note -Data Types of Semantic Values: Value Type.). The Bison parser will use -whatever type `YYSTYPE' is defined as; if you don't define it, `int' is -the default. Because we specify `double', each token and each -expression has an associated value, which is a floating point number. - - The `#include' directive is used to declare the exponentiation -function `pow'. - - The second section, Bison declarations, provides information to -Bison about the token types (*note The Bison Declarations Section: -Bison Declarations.). Each terminal symbol that is not a -single-character literal must be declared here. (Single-character -literals normally don't need to be declared.) In this example, all the -arithmetic operators are designated by single-character literals, so the -only terminal symbol that needs to be declared is `NUM', the token type -for numeric constants. -