Skip to content

Commit d4c63b5

Browse files
committed
debug some previously defined syntax
1 parent 5555111 commit d4c63b5

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

src/common/exp-syntax.k

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ syntax Exp ::=
5252
| Exp "-" Exp [seqstrict, klabel('Minus)]
5353

5454
//todo: change to LHS?
55-
syntax AssignExp ::= K "=" Exp [seqstrict, klabel('Assign)]
55+
syntax AssignExp ::= K "=" Exp [klabel('Assign)]
5656
syntax AssignExp ::= CompoundAssignExp
5757
syntax CompoundAssignExp ::= "dummyCompoundAssignExp"
5858
| Exp "*=" Exp [klabel('AssignMul)]

src/common/stmt-syntax.k

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ require "core-classes.k"
44
module STMT-SYNTAX
55
imports CORE-SORTS
66
imports CORE-CLASSES
7-
//todo:be specific
7+
88
syntax Stmt ::= StmtWithoutTrailing|LabeledStmt|IfThenElseStmt|IfThenStmt|WhileStmt|ForStmt
99

1010
syntax IfThenElseStmt ::= "if" "(" Exp ")" "{" K "}" "else" "{" K "}" [strict(1),klabel('If)]
@@ -25,8 +25,7 @@ syntax StmtWithoutTrailing ::= Block
2525
|SynchronizedStmt
2626

2727
syntax BlockStmt ::= Stmt|LocalVarDecStmt|ClassDecStmt
28-
syntax LocalVarDecStmt ::= LocalVarDec ";" [klabel('LocalVarDecStm)]
29-
syntax LocalVarDec ::= KListWrap Type Id [strict(2,3), klabel('LocalVarDec)]
28+
syntax LocalVarDecStmt ::= Type Id ";" [klabel('LocalVarDec)]
3029

3130
//todo:ClassDecStm
3231
syntax ClassDecStmt ::= "dummyclassdecstm"
@@ -44,11 +43,9 @@ syntax SwitchBlock::= "{" KListWrap KListWrap "}" [klabel('SwitchBlock)]
4443
syntax DoStmt ::="do" "{" K "}" "while" "(" K ")"[strict(2),klabel('DoWhile)]
4544
syntax TryStmt ::= "try" Block KListWrap "finally" Block [klabel('Try)]
4645
|"try" Block KListWrap [klabel('Try)]
46+
|"catch" "(" K ")" Block [klabel('Catch)]
4747
//todo:catches
48-
49-
syntax CatchClause ::= "catch" "(" K ")" Block [strict(1),klabel('Catch),result(ExtKResult)]
50-
51-
//syntax Catches ::= List{CatchClause,""}
48+
//syntax Catches ::= List{CatchClause,""}
5249
//syntax KItem ::= toCatches( KListWrap ) [function]
5350
// | toCatches( KListWrap , Catches ) [function]
5451
//rule [L:KList,,C:CatchClause] => toCatches([L,,C])
@@ -63,7 +60,7 @@ syntax BreakStmt ::= "break" K ";" [klabel('Break)]
6360
syntax ReturnStmt ::= "return" K ";" [klabel('Return)]
6461

6562
syntax SynchronizedStmt ::= "synchronized" "(" Exp ")" Block [strict(1),klabel('Synchronized)]
66-
//todo: replace Exp with StmtExp
63+
//todo: replace Exp with StmtExp when all StmtExp are defined
6764
syntax ExprStmt ::= Exp ";" [strict, klabel('ExprStm)]
6865

6966
endmodule

src/exec/api-threads.k

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ when
4646

4747
rule [Synchronized-first-time]:
4848
<k>
49-
synchronized (objectRef(OId:Int,_)::_) Block:Block
49+
synchronized (objectRef(OId:Int,_)::_) Block:K
5050
=> try Block [.KList] finally releaseLock(OId)
5151
...
5252
</k>
@@ -58,7 +58,7 @@ when
5858

5959
rule [Synchronized-nested]:
6060
<k>
61-
synchronized (objectRef(OId:Int,_)::_) Block:Block
61+
synchronized (objectRef(OId:Int,_)::_) Block:K
6262
=> try Block [.KList] finally releaseLock(OId)
6363
...
6464
</k>

src/exec/method-invoke.k

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ syntax KItem ::= initParams ( Params, // {T:Type X:Id},... - parameter declara
760760

761761
rule [initParams]:
762762
initParams(P{T:Type X:Id}, RestP:Params, (TV:TypedVal, RestV:TypedVals))
763-
=> [.KList] T X;
763+
=> T X;
764764
~> (X = ((T) TV:TypedVal));
765765
~> initParams(RestP, RestV)
766766

src/exec/statements.k

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ rule [env-double-Discard]:
4949
Not only local but fields also*/
5050

5151
rule [LocalVarDec]:
52-
<k> _:KListWrap T:Type X:Id; => . ...</k>
52+
<k> T:Type X:Id; => . ...</k>
5353
<env> Env:Map => Env[L/X] </env>
5454
<store>... . => L |-> default(T) ...</store>
5555
<storeMetadata>... . => L |-> LocalLocMetadata ...</storeMetadata>
@@ -423,6 +423,7 @@ rule [Try-Catch-Finally-Desugar]:
423423
context try _:K [_,, HOLE,, _]
424424

425425
//resolve 'Param term of the catch clause
426+
426427
context catch(HOLE)_ [result(ExtKResult)]
427428

428429
rule catch(KR:ExtKResult)S:K => catchImpl(KR,S)

src/exec/syntax-conversions.k

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ syntax MethodName ::= Id | MethodRef
6868

6969
/*@ \subsection{Local variable declaration}*/
7070

71-
//@ 'LocalVarDec(\_:K,, T:Type,, ['VarDec(X:Id)])
7271
syntax KLabel ::= "'VarDec"
73-
74-
rule 'LocalVarDec(_:KListWrap,, T:Type,,(['VarDec(X:Id)] => X)) [structural]
72+
rule 'LocalVarDec(_:K,, T:Type,,['VarDec(X:Id)]) => T X; [structural]
7573

7674
/*@ \subsection{Cast}*/
7775

0 commit comments

Comments
 (0)