-
Notifications
You must be signed in to change notification settings - Fork 152
/
Copy pathtest.k
73 lines (64 loc) · 2.04 KB
/
test.k
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) Runtime Verification, Inc. All Rights Reserved.
module TEST-SYNTAX
imports DOMAINS-SYNTAX
syntax Stmt ::= "addContract" "(" Id ")" ";"
| "addFunction" "(" Id "," Id ")" ";"
| "testFunction" "(" Id "," Id ")" ";"
| "testFunction1" "(" Int ")" ";"
> Stmt Stmt [left, format(%1%n%2)]
syntax Pgm ::= Stmt
endmodule
module TEST
imports TEST-SYNTAX
imports DOMAINS
configuration <T color="yellow">
<k color="green"> $PGM:Pgm </k>
<nextFunction> 0:Int </nextFunction>
<functions color="blue">
<function multiplicity = "*" type = "Map">
<fId> 0:Int </fId>
</function>
</functions>
<contracts color="orange">
<contract multiplicity = "*" type = "Map">
<cName> .K </cName>
<cFunctions> .Map </cFunctions>
</contract>
</contracts>
</T>
rule
<k> addContract(ContractName:Id); => .K ... </k>
<contracts>
...
(.Bag =>
<contract>
<cName> ContractName </cName>
<cFunctions> .Map </cFunctions>
</contract>)
...
</contracts>
rule
<k> addFunction(ContractName:Id, FunctionName:Id); => .K ... </k>
<contracts>
...
<contract>
<cName> ContractName </cName>
<cFunctions> ... .Map => FunctionName |-> N ... </cFunctions>
</contract>
...
</contracts>
<nextFunction> N => N +Int 1 </nextFunction>
<functions>
(.Bag => <function> <fId> N </fId> </function>)
...
</functions>
rule
<k> testFunction(ContractName:Id, FunctionName:Id); => "done" ... </k>
<contract>
<cName> ContractName </cName>
<cFunctions> ... FunctionName |-> N:Int ... </cFunctions>
</contract>
<function> <fId> N </fId> </function>
rule
S1:Stmt S2:Stmt => S1 ~> S2
endmodule