Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit dbb53bf

Browse files
authored
Add prose for reduction rule of try-delegate (#236)
Adjusted formal notation based on past review comments.
1 parent 7eb232b commit dbb53bf

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

document/core/exec/instructions.rst

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2643,15 +2643,28 @@ Control Instructions
26432643
:math:`\TRY~\blocktype~\instr^\ast~\DELEGATE~l`
26442644
...............................................
26452645

2646-
.. todo::
2647-
Add prose for the |TRY| - |DELEGATE| execution step.
2646+
1. Assert: due to :ref:`validation <valid-blocktype>`, :math:`\expand_F(\blocktype)` is defined.
2647+
2648+
2. Let :math:`[t_1^m] \to [t_2^n]` be the :ref:`function type <syntax-functype>` :math:`\expand_F(\blocktype)`.
2649+
2650+
3. Let :math:`L` be the label whose arity is :math:`n` and whose continuation is the end of the |TRY| instruction.
2651+
2652+
4. Let :math:`H` be the :ref:`delegating exception handler <syntax-handler>` :math:`\DELEGATEadm\{l\}`, targeting the :math:`l` surrounding block.
2653+
2654+
5. Assert: due to :ref:`validation <valid-try-delegate>`, there are at least :math:`m` values on the top of the stack.
2655+
2656+
6. Pop the values :math:`\val^m` from the stack.
2657+
2658+
7. :ref:`Enter <exec-instr-seq-enter>` the block :math:`H~(\val^n~\instr^\ast)~\END` with label :math:`L`.
2659+
2660+
8. :ref:`Install <exec-handler-enter>` the exception handler `H` containing :math:`\val^m~\instr^\ast`.
26482661

26492662
.. math::
26502663
~\\[-1ex]
26512664
\begin{array}{lcl}
2652-
F; \val^n~(\TRY~\X{bt}~\instr^\ast~\DELEGATE~l) &\stepto&
2653-
F; \LABEL_m\{\}~(\DELEGATEadm\{l\}~\val^n~\instr^\ast~\END)~\END \\
2654-
&& (\iff \expand_F(\X{bt}) = [t_1^n] \to [t_2^m])
2665+
F; \val^m~(\TRY~\X{bt}~\instr^\ast~\DELEGATE~l) &\stepto&
2666+
F; \LABEL_n\{\}~(\DELEGATEadm\{l\}~\val^m~\instr^\ast~\END)~\END \\
2667+
&& (\iff \expand_F(\X{bt}) = [t_1^m] \to [t_2^n])
26552668
\end{array}
26562669
26572670

0 commit comments

Comments
 (0)