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

Commit f59557e

Browse files
committed
More minor corrections, notation readability, "control" prose in block contexts.
Switching to "S ⊢ ..." notation for premises of typing rules for administrative instructions, to match the spec document. Readability: Changing quotes to number indices, and removing unnecessary explicit exponent variables. Suggesting prose for the new constructs in block contexts, connoting the new structured administrative instructions with control frame opcodes.
1 parent d63e833 commit f59557e

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

proposals/exception-handling/Exceptions-formal-overview.md

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ C ⊢ rethrow l : [t1*]→[t2*]
7474
7575
7676
C ⊢ bt : [t1*]→[t2*]
77-
C, labels [t2*] ⊢ instr* : [t1*]→[t2*]
77+
C, labels [t2*] ⊢ instr1* : [t1*]→[t2*]
7878
(C.tags[x] = [t*]→[] ∧
79-
C, labels (catch [t2*]) ⊢ instr'* : [t*]→[t2*])*
80-
(C, labels (catch [t2*]) ⊢ instr''* : []→[t2*])?
79+
C, labels (catch [t2*]) ⊢ instr2* : [t*]→[t2*])*
80+
(C, labels (catch [t2*]) ⊢ instr3* : []→[t2*])?
8181
-----------------------------------------------------------------------------
82-
C ⊢ try bt instr* (catch x instr'*)* (catch_all instr''*)? end : [t1*]→[t2*]
82+
C ⊢ try bt instr1* (catch x instr2*)* (catch_all instr3*)? end : [t1*]→[t2*]
8383
8484
8585
C ⊢ bt : [t1*]→[t2*]
@@ -130,6 +130,8 @@ C^k ::= 'catch'{ tagaddr? instr* }* B^k 'end'
130130
| 'delegate'{ labelidx } B^k 'end'
131131
```
132132

133+
Note the `C` in `C^k` above stands for `control`, because the related administrative instructions are in some ways modelling [control frame opcodes](https://webassembly.github.io/spec/core/appendix/algorithm.html?highlight=control#data-structures) "on the stack".
134+
133135
#### Throw Contexts
134136

135137
Throw contexts don't skip over handlers (administrative `catch` or `delegate` instructions).
@@ -152,34 +154,34 @@ An absent tag address in a `catch` administrative instruction (i.e., `a? = ε`)
152154
```
153155
F; throw x ↪ F; throw a (if F.module.tagaddrs[x]=a)
154156
155-
caught{a val^n} B^l[rethrow l] end
156-
↪ caught{a val^n} B^l[val^n (throw a)] end
157+
caught{a val*} B^l[rethrow l] end
158+
↪ caught{a val*} B^l[val* (throw a)] end
157159
158-
caught{a val^n} val^m end ↪ val^m
160+
caught{a val0*} val* end ↪ val*
159161
160162
161-
F; val^n (try bt instr* (catch x instr'*)* (catch_all instr''*)? end)
162-
↪ F; label_m{} (catch{a instr'*}*{ε instr''*}? val^n instr* end) end
163+
F; val^n (try bt instr1* (catch x instr2*)* (catch_all instr3*)? end)
164+
↪ F; label_m{} (catch{a instr2*}*{ε instr3*}? val^n instr1* end) end
163165
(if expand_F(bt) = [t1^n]→[t2^m] ∧ (F.module.tagaddrs[x]=a)*)
164166
165-
catch{a? instr*}* val^m end ↪ val^m
167+
catch{a? instr*}* val* end ↪ val*
166168
167-
S; F; catch{a1? instr*}{a'? instr'*}* T[val^n (throw a)] end
168-
↪ S; F; caught{a val^n} (val^n)? instr* end
169+
S; F; catch{a1? instr1*}{a0? instr0*}* T[val^n (throw a)] end
170+
↪ S; F; caught{a val^n} (val^n)? instr1* end
169171
(if (a1? = ε ∨ a1? = a) ∧ S.tags(a).type = [t^n]→[])
170172
171-
catch{a1? instr*}{a'? instr'*}* T[val^n (throw a)] end
172-
↪ catch{a'? instr'*}* T[val^n (throw a)] end
173+
catch{a1? instr*}{a0? instr0*}* T[val^n (throw a)] end
174+
↪ catch{a0? instr0*}* T[val^n (throw a)] end
173175
(if a1? ≠ ε ∧ a1? ≠ a)
174176
175-
catch T[val^n (throw a)] end ↪ val^n (throw a)
177+
catch T[val* (throw a)] end ↪ val* (throw a)
176178
177179
178180
F; val^n (try bt instr* delegate l)
179181
↪ F; label_m{} (delegate{l} val^n instr* end) end
180-
(if expand_F(bt) = [t^n]→[t^m])
182+
(if expand_F(bt) = [t1^n]→[t2^m])
181183
182-
delegate{l} val^n end ↪ val^n
184+
delegate{l} val* end ↪ val*
183185
184186
label_m{} B^l[ delegate{l} T[val^n (throw a)] end ] end
185187
↪ val^n (throw a)
@@ -194,24 +196,25 @@ There is a subtle difference though. The instruction `br l` searches for the `l+
194196

195197
### Typing Rules for Administrative Instructions
196198

199+
197200
```
198-
S.tags[a].type = [t*]→[]
199-
--------------------------------
201+
S ⊢ tag a : tag [t*]→[]
202+
-------------------------------
200203
S;C ⊢ throw a : [t1* t*]→[t2*]
201204
202-
((S.tags[a].type = [t'*]→[])?
203-
S;C, labels (catch [t*]) ⊢ instr'* : [t'*?]→[t*])*
204-
S;C, labels [t*] ⊢ instr* : []→[t*]
205+
((S ⊢ tag a : tag [t*]→[])?
206+
S;C, labels (catch [t2*]) ⊢ instr2* : [t1*?]→[t2*])*
207+
S;C, labels [t2*] ⊢ instr1* : []→[t2*]
205208
-----------------------------------------------------------
206-
S;C, labels [t*] ⊢ catch{a? instr'*}* instr* end : []→[t*]
209+
S;C, labels [t2*] ⊢ catch{a? instr2*}* instr1* end : []→[t2*]
207210
208211
S;C, labels [t*] ⊢ instr* : []→[t*]
209-
C.labels[l] = [t'*]
212+
C.labels[l] = [t0*]
210213
------------------------------------------------------
211214
S;C, labels [t*] ⊢ delegate{l} instr* end : []→[t*]
212215
213-
S.tags[a].type = [t'*]→[]
214-
(val:t')*
216+
S ⊢ tag a : tag [t0*]→[]
217+
(val:t0)*
215218
S;C, labels (catch [t*]) ⊢ instr* : []→[t*]
216219
----------------------------------------------------------
217220
S;C, labels [t*] ⊢ caught{a val^n} instr* end : []→[t*]

0 commit comments

Comments
 (0)