summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoel E. Denny <joeldenny@joeldenny.org>2011-05-29 20:06:22 -0400
committerJoel E. Denny <joeldenny@joeldenny.org>2011-05-29 20:52:42 -0400
commit7d31f0928907ccdd647479075d385b5a36c62611 (patch)
tree2515a461f55f7ebafafe99d6e87116583da42440 /doc
parent908c8647de654d4ab0944ecef7811af1d736742b (diff)
downloadbison-7d31f0928907ccdd647479075d385b5a36c62611.tar.gz
doc: motivate named references.
Suggested by Hans Aberg at <http://lists.gnu.org/archive/html/bug-bison/2011-05/msg00008.html>. * doc/bison.texinfo (Named References): Explain briefly how they're better than the traditional positional references.
Diffstat (limited to 'doc')
-rw-r--r--doc/bison.texinfo17
1 files changed, 11 insertions, 6 deletions
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 8fdac074..42ea8e28 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -4018,10 +4018,16 @@ statement when it is followed by a semicolon.
@section Using Named References
@cindex named references
-While every semantic value can be accessed with positional references
-@code{$@var{n}} and @code{$$}, it's often much more convenient to refer to
-them by name. First of all, original symbol names may be used as named
-references. For example:
+As described in the preceding sections, the traditional way to refer to any
+semantic value or location is a @dfn{positional reference}, which takes the
+form @code{$@var{n}}, @code{$$}, @code{@@@var{n}}, and @code{@@$}. However,
+such a reference is not very descriptive. Moreover, if you later decide to
+insert or remove symbols in the right-hand side of a grammar rule, the need
+to renumber such references can be tedious and error-prone.
+
+To avoid these issues, you can also refer to a semantic value or location
+using a @dfn{named reference}. First of all, original symbol names may be
+used as named references. For example:
@example
@group
@@ -4031,8 +4037,7 @@ invocation: op '(' args ')'
@end example
@noindent
-The positional @code{$$}, @code{@@$}, @code{$n}, and @code{@@n} can be
-mixed with @code{$name} and @code{@@name} arbitrarily. For example:
+Positional and named references can be mixed arbitrarily. For example:
@example
@group