@@ -90,9 +90,10 @@ Notation
9090
9191.. index :: BNF, grammar, syntax, notation
9292
93- The descriptions of lexical analysis and syntax use a modified
94- `Backus–Naur form (BNF) <https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form >`_ grammar
95- notation. This uses the following style of definition:
93+ The descriptions of lexical analysis use a grammar notation that is a mixture
94+ of `EBNF <https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form >`_
95+ and `PEG <https://en.wikipedia.org/wiki/Parsing_expression_grammar >`_.
96+ For example:
9697
9798.. grammar-snippet ::
9899 :group: notation
@@ -136,7 +137,11 @@ The definition to the right of the colon uses the following syntax elements:
136137* ``e1 e2 ``: Items separated only by whitespace denote a sequence.
137138 Here, ``e1 `` must be followed by ``e2 ``.
138139* ``e1 | e2 ``: A vertical bar is used to separate alternatives.
139- It is the least tightly binding operator in this notation.
140+ It denotes PEG's "ordered choice": if ``e1 `` matches, ``e2 `` is
141+ not considered.
142+ In traditional PEG grammars, this is written as a slash, ``/ ``, rather than
143+ a vertical bar.
144+ See :pep: `617 ` for more background and details.
140145* ``e* ``: A star means zero or more repetitions of the preceding item.
141146* ``e+ ``: Likewise, a plus means one or more repetitions.
142147* ``[e] ``: A phrase enclosed in square brackets means zero or
@@ -145,7 +150,8 @@ The definition to the right of the colon uses the following syntax elements:
145150 the preceding item is optional.
146151* ``(e) ``: Parentheses are used for grouping.
147152
148- The unary operators (``* ``, ``+ ``, ``? ``) bind as tightly as possible.
153+ The unary operators (``* ``, ``+ ``, ``? ``) bind as tightly as possible;
154+ the vertical bar (``| ``) binds most loosely.
149155
150156White space is only meaningful to separate tokens.
151157
0 commit comments