Add rule identifiers to notation chapter
We originally hadn't added rule identifiers to the notation chapter as
in some sense these aren't language rules. However, as it turns out,
it's still useful to have these so as to be able to refer by name to
particular sections. And anyway, since the language rules are defined
in terms of this notation, the notation rules are in a sense normative
at a meta level.
In doing this, we'll nest certain sections under the grammar section
that should be so nested.
diff --git a/src/notation.md b/src/notation.md
index de26242..4374bf4 100644
--- a/src/notation.md
+++ b/src/notation.md
@@ -1,7 +1,11 @@
+r[notation]
# Notation
+r[notation.grammar]
## Grammar
+r[notation.grammar.syntax]
+
The following notations are used by the *Lexer* and *Syntax* grammar snippets:
| Notation | Examples | Meaning |
@@ -26,7 +30,8 @@
Sequences have a higher precedence than `|` alternation.
-## String table productions
+r[notation.grammar.string-tables]
+### String table productions
Some rules in the grammar — notably [unary operators], [binary
operators], and [keywords] — are given in a simplified form: as a listing
@@ -40,13 +45,15 @@
it is an implicit reference to a single member of such a string table
production. See [tokens] for more information.
-## Grammar visualizations
+r[notation.grammar.visualizations]
+### Grammar visualizations
Below each grammar block is a button to toggle the display of a [syntax diagram]. A square element is a non-terminal rule, and a rounded rectangle is a terminal.
[syntax diagram]: https://en.wikipedia.org/wiki/Syntax_diagram
-## Common productions
+r[notation.grammar.common]
+### Common productions
The following are common definitions used in the grammar.