Skip to content

Commit 0adfec3

Browse files
authored
Merge pull request #1989 from epage/notation
Link out to the notation from grammar summary
2 parents bcb96fb + 7da73b2 commit 0adfec3

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

src/grammar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Grammar summary
22

3-
The following is a summary of the grammar production rules.
3+
The following is a summary of the grammar production rules. For details on the syntax of this grammar, see *[notation.grammar.syntax]*.
44

55
{{ grammar-summary }}

src/input-format.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
r[input]
22
# Input format
33

4+
r[input.syntax]
5+
```grammar,lexer
6+
@root CHAR -> <a Unicode scalar value>
7+
8+
NUL -> U+0000
9+
10+
TAB -> U+0009
11+
12+
LF -> U+000A
13+
14+
CR -> U+000D
15+
```
16+
417
r[input.intro]
518
This chapter describes how a source file is interpreted as a sequence of tokens.
619

src/notation.md

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
r[notation]
12
# Notation
23

4+
r[notation.grammar]
35
## Grammar
46

7+
r[notation.grammar.syntax]
8+
59
The following notations are used by the *Lexer* and *Syntax* grammar snippets:
610

711
| Notation | Examples | Meaning |
@@ -26,7 +30,8 @@ The following notations are used by the *Lexer* and *Syntax* grammar snippets:
2630

2731
Sequences have a higher precedence than `|` alternation.
2832

29-
## String table productions
33+
r[notation.grammar.string-tables]
34+
### String table productions
3035

3136
Some rules in the grammar &mdash; notably [unary operators], [binary
3237
operators], and [keywords] &mdash; are given in a simplified form: as a listing
@@ -40,30 +45,13 @@ When such a string in `monospace` font occurs inside the grammar,
4045
it is an implicit reference to a single member of such a string table
4146
production. See [tokens] for more information.
4247

43-
## Grammar visualizations
48+
r[notation.grammar.visualizations]
49+
### Grammar visualizations
4450

4551
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.
4652

47-
[syntax diagram]: https://en.wikipedia.org/wiki/Syntax_diagram
48-
49-
## Common productions
50-
51-
The following are common definitions used in the grammar.
52-
53-
r[input.syntax]
54-
```grammar,lexer
55-
@root CHAR -> <a Unicode scalar value>
56-
57-
NUL -> U+0000
58-
59-
TAB -> U+0009
60-
61-
LF -> U+000A
62-
63-
CR -> U+000D
64-
```
65-
6653
[binary operators]: expressions/operator-expr.md#arithmetic-and-logical-binary-operators
6754
[keywords]: keywords.md
55+
[syntax diagram]: https://en.wikipedia.org/wiki/Syntax_diagram
6856
[tokens]: tokens.md
6957
[unary operators]: expressions/operator-expr.md#borrow-operators

0 commit comments

Comments
 (0)