forked from runtimeverification/python-semantics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython-semantics-syntax.k
More file actions
45 lines (32 loc) · 1000 Bytes
/
Copy pathpython-semantics-syntax.k
File metadata and controls
45 lines (32 loc) · 1000 Bytes
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
require "python-syntax.k"
module PYTHON-SEMANTICS-SYNTAX
imports PYTHON-SYNTAX
syntax Value ::= NUMBER
| STRING
syntax Object ::= "obj" "(" ObjId "," Bag ")"
syntax ObjId ::= Int
| String
syntax Expression ::= ObjRef
| Null
| Undefined
| ObjId
syntax Null ::= ".Obj"
syntax ObjectPointer ::= Object | Null
syntax Undefined ::= "undefined" "(" String ")"
rule isKResult(obj(_,_)) => true
rule isKResult(true) => true
rule isKResult(false) => true
rule isKResult(.Obj) => true
rule isKResult(undefined(_)) => true
rule isKResult(list(_)) => true
rule isKResult(map(_)) => true
syntax Statement ::= Expression
syntax Test ::= Bool
syntax ObjRef ::= Object
syntax K ::= "list" "(" List ")"
syntax K ::= "map" "(" Map ")"
rule isValue(list(_)) => true
rule isExpression(list(_)) => true
rule isValue(map(_)) => true
rule isExpression(map(_)) => true
endmodule