Skip to content

Commit 1041527

Browse files
vurscVursc
andauthored
[spec] Conventions for "large productions" (#1937)
Co-authored-by: Vursc <[email protected]>
1 parent 6faed61 commit 1041527

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

document/core/binary/conventions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ In order to distinguish symbols of the binary syntax from symbols of the abstrac
5858

5959
* Productions are written :math:`\B{sym} ::= B_1 \Rightarrow A_1 ~|~ \dots ~|~ B_n \Rightarrow A_n`, where each :math:`A_i` is the attribute that is synthesized for :math:`\B{sym}` in the given case, usually from attribute variables bound in :math:`B_i`.
6060

61+
* Large productions may be split into multiple definitions, indicated by ending the first one with explicit ellipses, :math:`\B{sym} ::= B_1 \Rightarrow A_1 ~|~ \dots`, and starting continuations with ellipses, :math:`\B{sym} ::= \dots ~|~ B_2 \Rightarrow A_2`.
62+
6163
* Some productions are augmented by side conditions in parentheses, which restrict the applicability of the production. They provide a shorthand for a combinatorial expansion of the production into many separate cases.
6264

6365
* If the same meta variable or non-terminal symbol appears multiple times in a production (in the syntax or in an attribute), then all those occurrences must have the same instantiation.

document/core/binary/instructions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ Control Instructions
6262
&\Rightarrow& \BRTABLE~l^\ast~l_N \\ &&|&
6363
\hex{0F} &\Rightarrow& \RETURN \\ &&|&
6464
\hex{10}~~x{:}\Bfuncidx &\Rightarrow& \CALL~x \\ &&|&
65-
\hex{11}~~y{:}\Btypeidx~~x{:}\Btableidx &\Rightarrow& \CALLINDIRECT~x~y \\
65+
\hex{11}~~y{:}\Btypeidx~~x{:}\Btableidx &\Rightarrow& \CALLINDIRECT~x~y \\ &&|&
66+
\dots
6667
\end{array}
6768
6869
.. note::

document/core/text/conventions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ In order to distinguish symbols of the textual syntax from symbols of the abstra
5353

5454
* Productions are written :math:`\T{sym} ::= T_1 \Rightarrow A_1 ~|~ \dots ~|~ T_n \Rightarrow A_n`, where each :math:`A_i` is the attribute that is synthesized for :math:`\T{sym}` in the given case, usually from attribute variables bound in :math:`T_i`.
5555

56+
* Large productions may be split into multiple definitions, indicated by ending the first one with explicit ellipses, :math:`\T{sym} ::= T_1 \Rightarrow A_1 ~|~ \dots`, and starting continuations with ellipses, :math:`\T{sym} ::= \dots ~|~ T_2 \Rightarrow A_2`.
57+
5658
* Some productions are augmented by side conditions in parentheses, which restrict the applicability of the production. They provide a shorthand for a combinatorial expansion of the production into many separate cases.
5759

5860
* If the same meta variable or non-terminal symbol appears multiple times in a production (in the syntax or in an attribute), then all those occurrences must have the same instantiation.

document/core/text/instructions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ All other control instruction are represented verbatim.
118118
\text{return} &\Rightarrow& \RETURN \\ &&|&
119119
\text{call}~~x{:}\Tfuncidx_I &\Rightarrow& \CALL~x \\ &&|&
120120
\text{call\_indirect}~~x{:}\Ttableidx~~y,I'{:}\Ttypeuse_I &\Rightarrow& \CALLINDIRECT~x~y
121-
& (\iff I' = \{\ILOCALS~(\epsilon)^\ast\}) \\
121+
& (\iff I' = \{\ILOCALS~(\epsilon)^\ast\}) \\ &&|&
122+
\dots
122123
\end{array}
123124
124125
.. note::

0 commit comments

Comments
 (0)