You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an administrative throw occurs, then values, labels, |CAUGHTadm| instructions,
3020
+
and call frames are popped if necessary, until an appropriate exception handler is found
3021
+
on the top of the stack.
3022
+
3023
+
1. Assert: due to validation, :math:`S.\STAGS[a]` exists.
3024
+
3025
+
2. Let :math:`[t^n] \to []` be the :ref:`tag type <syntax-tagtype>` :math:`S.\STAGS[a].\TAGITYPE`.
3026
+
3027
+
3. Assert: due to :ref:`validation <valid-throw>`, there are :math:`n` values on the top of the stack.
3028
+
3029
+
4. Pop the :math:`n` values :math:`\val^n` from the stack.
3030
+
3031
+
5. While the stack is not empty and the top of the stack is not an :ref:`exception handler <syntax-handler>`, do:
3032
+
3033
+
a. Pop the top element from the stack, prepending it to the :ref:`throw context <syntax-ctxt-throw>` of the exception: :math:`\XT[\val^n~(\THROWadm~a)]`.
3034
+
3035
+
6. Assert: The stack is now either empty, or there is an exception handler on the top of the stack.
3036
+
3037
+
7. If the stack is empty, then:
3038
+
3039
+
a. **TODO** *Return a result value representing the uncaught exception (will probably just be the same as 11.a.i. below).*
3040
+
3019
3041
.. todo::
3020
-
Add prose for the following execution steps.
3042
+
After PR #221 is resolved, this step should be filled in with a PR to specify uncaught exception results.
3043
+
3044
+
8. Else there is an :ref:`exception handler <syntax-handler>` :math:`H` on the top of the stack.
3045
+
3046
+
9. Pop the exception handler :math:`H` from the stack.
3047
+
3048
+
10. Assert: :math:`H` is either of the form :math:`\CATCHadm\{a^?~\instr^\ast\}^k` or :math:`\DELEGATEadm\{l\}.`
3049
+
3050
+
11. If :math:`H` is of the form :math:`\CATCHadm\{a^?~\instr^\ast\}^k`, then:
3051
+
3052
+
a. If :math:`k = 0`, then:
3053
+
3054
+
i. Push the throw context that we collected so far :math:`\XT[\val^n~(\THROWadm~a)]` onto the stack.
3055
+
3056
+
b. Else :math:`H` is of the form :math:`\CATCHadm\{a_1^?~\instr^\ast\}\{a'^?~\instr'^\ast\}^\ast`.
3057
+
3058
+
c. If :math:`a_1^? = \epsilon`, then:
3059
+
3060
+
i. Push :math:`\CAUGHTadm\{a~\val^n\}` onto the stack.
3021
3061
3062
+
ii. Jump to the start of the instruction sequence :math:`\instr^\ast`.
3063
+
3064
+
d. Else if :math:`a_1 = a`, then:
3065
+
3066
+
i. Push :math:`\CAUGHTadm\{a~\val^n\}` onto the stack.
3067
+
3068
+
ii. Push the values :math:`\val^n` back to the stack.
3069
+
3070
+
iii. Jump to the start of the instruction sequence :math:`\instr^\ast`.
3071
+
3072
+
e. Else, repeat step 11 for :math:`H = \CATCHadm\{a'^?~\instr'^\ast\}^\ast`.
3073
+
3074
+
12. Else the handler :math:`H` has the form :math:`\DELEGATEadm\{l\}`.
3075
+
3076
+
13. Assert: due to :ref:`validation <valid-delegate-admin>`, the stack contains at least :math:`l+1` labels.
3077
+
3078
+
14. Let :math:`L` be the :math:`l`-th label appearing on the stack, starting from the top and counting from zero.
3079
+
3080
+
15. Repeat :math:`l+1` times:
3081
+
3082
+
a. While the instruction on the top of the stack is not a label, do:
3083
+
3084
+
i. Pop the instruction from the stack, without pushing it to |XT|.
3085
+
3086
+
b. Assert: due to :ref:`validation <valid-delegate-admin>`, the top of the stack now is a label.
3087
+
3088
+
c. Pop the label from the stack.
3089
+
3090
+
16. Push the throw context that we collected so far :math:`\XT[\val^n~(\THROWadm~a)]` onto the stack.
0 commit comments