forked from kframework/c-semantics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv.k
41 lines (33 loc) · 1.13 KB
/
env.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
module C-ENV-SYNTAX
imports C-SYNTAX
imports C-SYMLOC-SYNTAX
imports C-DYNAMIC-SYNTAX
syntax KItem ::= addToEnv(CId, SymBase)
syntax KItem ::= giveType(CId, Type)
syntax KItem ::= "populateFromGlobal"
syntax KItem ::= addToHistory(Int)
endmodule
module C-ENV
imports C-ENV-SYNTAX
imports C-BITSIZE-SYNTAX
imports C-TYPING-SYNTAX
imports C-CONFIGURATION
rule <k> addToHistory(BlockNum:Int) => .K ...</k>
<block-history> .List => ListItem(BlockNum) ...</block-history>
[structural]
rule <k> populateFromGlobal => .K ...</k>
<curr-tu> Tu:String </curr-tu>
<tu-id> Tu </tu-id>
<genv> G:Map </genv>
<gtypes> GT:Map </gtypes>
<env> _ => G </env>
<types> _ => GT </types>
[structural]
rule <k> addToEnv(X:CId, Base:SymBase) => .K ...</k>
<env> E:Map => E[X <- Base] </env>
[structural]
rule <k> giveType(X:CId, T:Type) => .K ...</k>
<types> L:Map => L[X <- tagRestrict(S, T)] </types>
<curr-scope> S:Scope </curr-scope>
[structural]
endmodule