@@ -26,8 +26,8 @@ rule [ExecutionPhase-Start]:
26
26
<mainClass> ListItem(MainClassS:String) </mainClass>
27
27
<globalPhase> UnfoldingPhase => ExecutionPhase </globalPhase>
28
28
29
- syntax KLabel ::= "'Empty "
30
- | "'Labeled"
29
+ syntax KLabel ::= "'Block "
30
+ // | "'Labeled"
31
31
// | "'ExprStm"
32
32
// | "'AssertStm"
33
33
// | "'Switch"
@@ -44,7 +44,6 @@ syntax KLabel ::= "'Empty"
44
44
// | "'Throw"
45
45
| "'Try"
46
46
| "'Catch"
47
- | "'Block"
48
47
49
48
50
49
//@ \subsection{Blocks} JLS \$14.2
@@ -80,12 +79,12 @@ rule [LocalVarDec]:
80
79
//@ \subsection{Empty statement} JLS \$14.6
81
80
82
81
rule [Empty]:
83
- 'Empty(_) => .
82
+ ; => .
84
83
85
84
//@ \subsection{Labeled statements} JLS \$14.7
86
85
87
86
rule [Labeled]:
88
- 'Labeled( X:Id,, S:K) => S ~> labeledImpl(X)
87
+ X:Id : S:K => S ~> labeledImpl(X)
89
88
90
89
//@ Processed version of the labeled statement
91
90
syntax KItem ::= labeledImpl ( Id )
@@ -128,19 +127,17 @@ rule [AssertStm-FirstFalse]:
128
127
129
128
syntax KItem ::= switchImpl (
130
129
TypedVal, // TV - switch argument
131
- KListWrap, // switch body - list of 'SwitchGroup labels "case Exp : body"
130
+ KListWrap, // switch body - list of 'SwitchGroup labels
132
131
K // DefaultStm - default block, if any
133
132
)
134
133
135
- //context 'Switch(HOLE,,_)
136
-
137
134
//@ The switchEnd in the right-hand side of => is required to properly interact with break.
138
135
rule [Switch]:
139
- switch(TV:TypedVal){[Ks:KList] TrailingLabels:K }
140
- => switchImpl(TV, [Ks,, TrailingLabels : .K], .K)
136
+ switch(TV:TypedVal){[Ks:KList] [ TrailingLabels:KList] }
137
+ => switchImpl(TV, [Ks,, [ TrailingLabels] .K], .K)
141
138
~> switchEnd
142
139
143
- context switchImpl( _, [ [case HOLE ,, _:KList] : _ ,, _:KList ], _)
140
+ context switchImpl( _, [ [case HOLE : ,, _:KList] _ ,, _:KList], _)
144
141
145
142
/*@ The type associated to V and V2 is not important for match, only the value.
146
143
JLS3 \$14.11, page 377: Every case constant expression associated with
@@ -149,7 +146,7 @@ a switch statement must be assignable (�5.2) to the type of the switch Express
149
146
rule [switchImpl-CaseNotMatch]:
150
147
switchImpl(
151
148
V:RawVal :: _,
152
- [ [ ( case V2:RawVal :: _ => .KList ),, _:KList ] : _ ,, _],
149
+ [ [ ( case V2:RawVal :: _ : => .KList ),, _:KList ] _ ,, _],
153
150
_
154
151
)
155
152
when
@@ -161,30 +158,30 @@ constructs and will execute the statements. */
161
158
rule [switchImpl-CaseMatch]:
162
159
switchImpl(
163
160
V:RawVal :: _,
164
- [[case V :: _ ,, _:KList] : S:K,, Ks:KList],
161
+ [[case V :: _ : ,, _:KList] S:K,, Ks:KList],
165
162
_
166
163
)
167
164
=> [S,,Ks]
168
165
169
166
rule [switchImpl-DefaultSave]:
170
167
switchImpl(
171
168
TV:TypedVal,
172
- [[ ( default => .KList ),, _:KList] : S:K,, Ks:KList],
169
+ [[ ( default: => .KList ),, _:KList] S:K,, Ks:KList],
173
170
( _:K => [S,, Ks] )
174
171
)
175
172
176
173
rule [switchImpl-SwitchGroup-Discard]:
177
174
switchImpl(
178
175
TV:TypedVal,
179
- [( [ .KList ]: _ => .KList ),, _],
176
+ [( [ .KList ] _ => .KList ),, _],
180
177
_
181
178
)
182
179
183
180
rule [switchImpl-Default-Exec]:
184
181
switchImpl( _, [.KList], DefaultStm:K) => DefaultStm
185
182
186
183
rule [SwitchGroup-Exec]:
187
- _:KListWrap : S => S
184
+ _:KListWrap S:K => S
188
185
189
186
syntax KItem ::= "switchEnd"
190
187
@@ -439,20 +436,20 @@ rule [Throw-CausesThreadTermination]:
439
436
//@ \subsection{Try statement}
440
437
441
438
rule [Try-Catch-Finally-Desugar]:
442
- 'Try( TryS:K,, [K:K,, Ks:KList],, FinallyS:K)
443
- => 'Try('Try( TryS,, [K,,Ks]),, [.KList],, FinallyS)
439
+ try TryS:K [K:K,, Ks:KList] finally FinallyS:K
440
+ => try {try TryS [K,,Ks]} [.KList] finally FinallyS
444
441
[structural]
445
442
446
443
/*@ \subsubsection{Execution of try-catch} JLS \$14.20.1
447
444
*/
448
445
449
446
//resolve the catch clauses of try statement
450
- context 'Try( _:K,, [_,, HOLE,, _])
447
+ context try _:K [_,, HOLE,, _]
451
448
452
449
//resolve 'Param term of the catch clause
453
- context 'Catch (HOLE,, _) [result(ExtKResult)]
450
+ context catch (HOLE)_ [result(ExtKResult)]
454
451
455
- rule 'Catch (KR:ExtKResult,, S:K) => catchImpl(KR,S)
452
+ rule catch (KR:ExtKResult) S:K => catchImpl(KR,S)
456
453
457
454
/*@ Extended K Result.
458
455
Represents KLabels that should be treated as KResult during execution phase, but not during elaboration phase.
@@ -470,7 +467,7 @@ syntax KResult ::= catchImpl (
470
467
)
471
468
472
469
rule [Try-Catch]:
473
- 'Try( TryS:K,, [KRs:KList]) => TryS ~> catchBlocks([KRs])
470
+ try TryS:K [KRs:KList] => TryS ~> catchBlocks([KRs])
474
471
when isKResult(KRs)
475
472
476
473
/*@ The auxiliary construct that holds catch clauses
@@ -487,7 +484,7 @@ rule [catchBlocks-Discard]:
487
484
*/
488
485
489
486
rule [Try-Finally]:
490
- 'Try( TryS:K,, [.KList],, FinallyS:K) => TryS ~> finallyBlock(FinallyS)
487
+ try TryS:K [.KList] finally FinallyS:K => TryS ~> finallyBlock(FinallyS)
491
488
492
489
/*@ The auxiliary construct that holds finally clause
493
490
after try clause has been moved to the top of computation*/
0 commit comments