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
{{ message }}
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
Add prose for reduction rules involving thrown exceptions, (#226)
- Add prose for reduction rules involving thrown exceptions.
- Change administrative handler instructions and adding caught exceptions to the runtime stack.
+ In particular:
* Switched to
handler ::= (tagaddr? instr*)* | labelidx
exn ::= tagaddr val*
instr ::= … | handler_n{handler} instr* end | caught_n{exn} instr* end
removing DELEGATEadm
- Changed prose to just push and pop handlers and exceptions, in the runtime,
in the execution steps of the instructions, in the formal overview,
and partly in appendix/properties.
- Apply suggestions from code review
Co-authored-by: Heejin Ahn <[email protected]>
Co-authored-by: Andreas Rossberg <[email protected]>
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label type <syntax-labeltype>` :math:`[t_2^\ast]` prepended to the |CLABELS| vector.
621
621
622
622
* Under context :math:`C'`,
623
-
the instruction sequence :math:`\instr_2^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[] \to [t_2^\ast]`.
623
+
the instruction sequence :math:`\instr_2^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[] \to [t_2^n]`.
624
624
625
-
* Let :math:`C''` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label type <syntax-labeltype>` :math:`(\LCATCH~[t_2^\ast])` prepended to the |CLABELS| vector.
625
+
* Let :math:`C''` be the same :ref:`context <context>` as :math:`C`, but with the :ref:`label type <syntax-labeltype>` :math:`(\LCATCH~[t_2^n])` prepended to the |CLABELS| vector.
626
626
627
627
* Under context :math:`C''`,
628
628
for every :math:`\tagaddr^?` and associated instruction sequence :math:`\instr_1^\ast`:
629
629
630
-
* If :math:`\tagaddr^? = \epsilon`, then :math:`\instr_1^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[] \to [t_2^\ast]`.
630
+
* If :math:`\tagaddr^? = \epsilon`, then :math:`\instr_1^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[] \to [t_2^n]`.
631
631
632
632
* Else:
633
633
634
634
* The :ref:`external tag value <syntax-externval>` :math:`\EVTAG~\tagaddr` must be :ref:`valid <valid-externval-tag>` with some :ref:`external tag type <syntax-externtype>` :math:`\ETTAG~[t_1^\ast] \to []`.
635
635
636
-
* The instruction sequence :math:`\instr_1^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[t_1^\ast] \to [t_2^\ast]`.
636
+
* The instruction sequence :math:`\instr_1^\ast` must be :ref:`valid <valid-instr-seq>` with type :math:`[t_1^\ast] \to [t_2^n]`.
637
637
638
-
* Then the compound instruction is valid under context :math:`C'` with type :math:`[] \to [t_2^\ast]`.
638
+
* Then the compound instruction is valid under context :math:`C'` with type :math:`[] \to [t_2^n]`.
b. Let :math:`a_i` be the tag address :math:`F.\AMODULE.\MITAGS[x_i]`.
2638
2638
2639
-
c. Let :math:`H_i` be the handler clause :math:`\{a_i~\instr_{2i}^\ast\}`.
2639
+
c. Let :math:`H_i` be the handler :math:`(a_i~\instr_{2i}^\ast)`.
2640
2640
2641
2641
8. If there is a catch all clause :math:`(\CATCHALL~\instr_3^\ast)`, then:
2642
2642
2643
-
a. Let :math:`H'^?` be the handler clause :math:`\{\epsilon~\instr_3^\ast\}`.
2643
+
a. Let :math:`H'^?` be the handler :math:`(\epsilon~\instr_3^\ast)`.
2644
2644
2645
2645
9. Else:
2646
2646
2647
-
a. Let :math:`H'^?` be the empty handler clause :math:`\epsilon`.
2647
+
a. Let :math:`H'^?` be the empty handler :math:`\epsilon`.
2648
2648
2649
-
10. Let :math:`H^\ast` be the :ref:`catching exception handler <syntax-handler>` containing the concatenation of the handler clauses:math:`H_i` and :math:`H'^?`.
2649
+
10. Let :math:`H^\ast` be the concatenation of :math:`H_i` and :math:`H'^?`.
2650
2650
2651
-
11. :ref:`Enter <exec-handler-enter>` the block :math:`\val^m~\instr_1^\ast` with label :math:`L` and exception handler :math:`H`.
2651
+
11. :ref:`Enter <exec-handler-enter>` the block :math:`\val^m~\instr_1^\ast` with label :math:`L` and exception handler :math:`H^\ast`.
An exception can only be rethrown from the scope of the |CAUGHTadm| administrative instruction holding it, i.e., from the scope of the |CATCH| or |CATCHALL| block of a :ref:`try-catch <syntax-try-catch>` instruction that caught it. Upon exit from a |CAUGHTadm|, the exception it holds is discarded.
3184
+
A caught exception can only be rethrown from the scope of the administrative instruction associated with it, i.e., from the scope of the |CATCH| or |CATCHALL| block of a :ref:`try-catch <syntax-try-catch>` instruction that caught it. Upon exit from that block, the caught exception is discarded.
3113
3185
3114
3186
3115
3187
.. index:: ! call, function, function instance, label, frame
0 commit comments