]> git.saurik.com Git - bison.git/blobdiff - doc/bison.texinfo
Fix two nits reported by twlevo, plus one more that I discovered.
[bison.git] / doc / bison.texinfo
index eb36845f3499eb5b538c9ccff10c63d4bf5c1fbb..3aac11e436fce244f03c087432bb43b34dcd224e 100644 (file)
@@ -336,16 +336,16 @@ Copying This Manual
 @unnumbered Introduction
 @cindex introduction
 
-@dfn{Bison} is a general-purpose parser generator that converts a
-grammar description for an @acronym{LALR}(1) context-free grammar into a C
-program to parse that grammar.  Once you are proficient with Bison,
-you may use it to develop a wide range of language parsers, from those
+@dfn{Bison} is a general-purpose parser generator that converts a grammar
+description for an @acronym{LALR}(1) or @acronym{GLR} context-free grammar
+into a C or C++ program to parse that grammar.  Once you are proficient with
+Bison, you can use it to develop a wide range of language parsers, from those
 used in simple desk calculators to complex programming languages.
 
 Bison is upward compatible with Yacc: all properly-written Yacc grammars
 ought to work with Bison with no change.  Anyone familiar with Yacc
 should be able to use Bison with little trouble.  You need to be fluent in
-C programming in order to use Bison or to understand this manual.
+C or C++ programming in order to use Bison or to understand this manual.
 
 We begin with tutorial chapters that explain the basic concepts of using
 Bison and show three explained examples, each building on the last.  If you
@@ -1135,13 +1135,16 @@ memory referenced by @code{yylval}.
 @findex YYERROR
 @cindex @acronym{GLR} parsers and @code{YYERROR}
 Another Bison feature requiring special consideration is @code{YYERROR}
-(@pxref{Action Features}), which you can invoke in any semantic action to
+(@pxref{Action Features}), which you can invoke in a semantic action to
 initiate error recovery.
 During deterministic @acronym{GLR} operation, the effect of @code{YYERROR} is
 the same as its effect in an @acronym{LALR}(1) parser.
 In a deferred semantic action, its effect is undefined.
 @c The effect is probably a syntax error at the split point.
 
+Also, see @ref{Location Default Action, ,Default Action for Locations}, which
+describes a special usage of @code{YYLLOC_DEFAULT} in @acronym{GLR} parsers.
+
 @node Compiler Requirements
 @subsection Considerations when Compiling @acronym{GLR} Parsers
 @cindex @code{inline}
@@ -3571,6 +3574,7 @@ This location is stored in @code{yylloc}.
 @node Location Default Action
 @subsection Default Action for Locations
 @vindex YYLLOC_DEFAULT
+@cindex @acronym{GLR} parsers and @code{YYLLOC_DEFAULT}
 
 Actually, actions are not the best place to compute locations.  Since
 locations are much more general than semantic values, there is room in
@@ -3578,6 +3582,9 @@ the output parser to redefine the default action to take for each
 rule.  The @code{YYLLOC_DEFAULT} macro is invoked each time a rule is
 matched, before the associated action is run.  It is also invoked
 while processing a syntax error, to compute the error's location.
+Before reporting an unresolvable syntactic ambiguity, a @acronym{GLR}
+parser invokes @code{YYLLOC_DEFAULT} recursively to compute the location
+of that ambiguity.
 
 Most of the time, this macro is general enough to suppress location
 dedicated code from semantic actions.
@@ -3586,9 +3593,11 @@ The @code{YYLLOC_DEFAULT} macro takes three parameters.  The first one is
 the location of the grouping (the result of the computation).  When a
 rule is matched, the second parameter identifies locations of
 all right hand side elements of the rule being matched, and the third
-parameter is the size of the rule's right hand side.  When processing
-a syntax error, the second parameter identifies locations of
-the symbols that were discarded during error processing, and the third
+parameter is the size of the rule's right hand side.
+When a @acronym{GLR} parser reports an ambiguity, which of multiple candidate
+right hand sides it passes to @code{YYLLOC_DEFAULT} is undefined.
+When processing a syntax error, the second parameter identifies locations
+of the symbols that were discarded during error processing, and the third
 parameter is the number of discarded symbols.
 
 By default, @code{YYLLOC_DEFAULT} is defined this way: