-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlanguage.v
More file actions
77 lines (63 loc) · 1.95 KB
/
language.v
File metadata and controls
77 lines (63 loc) · 1.95 KB
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
Require Import util.
Require Import Coq.Lists.List.
Require Import Coq.Arith.Arith.
Require Import Coq.omega.Omega.
Import ListNotations.
(*******语法部分********)
(*算术表达式*)
Inductive aexp: Type :=
| ANum : nat -> aexp
| AId : id -> aexp (* Var *)
| APlus : aexp -> aexp -> aexp
| AMult : aexp -> aexp -> aexp
| AMinus : aexp -> aexp -> aexp.
(*块表达式*)
Inductive bkexp : Type :=
| BKNum : nat -> bkexp
| BKId : id -> bkexp (* BKVar *)
| BKAddr: id -> aexp -> bkexp.
Inductive fexp : Type :=
(* | FNil : nil -> fexp *)
| FId : id -> fexp
| Fattach : fexp -> bkexp -> fexp.
(*布尔表达式*)
Inductive bexp: Type :=
| BTrue : bexp
| BFalse: bexp
| BEq : aexp -> aexp -> bexp
| BLe : aexp -> aexp -> bexp
| BNot : bexp -> bexp
| BAnd : bexp -> bexp -> bexp
| BOr : bexp -> bexp -> bexp.
Inductive command: Type :=
| CSkip : command
| CAss : id -> aexp -> command
| CSeq : command -> command -> command
| CIf : bexp -> command -> command -> command
| CWhile : bexp -> command -> command
| CCons : id -> aexp -> command (*只创建一个存储空间*)
| CLookup : id -> aexp -> command
| CMutate : aexp -> aexp -> command
| CDispose : aexp -> command
(*file*)
| CFcreate : id -> bkexp -> command
| CFattach : id -> bkexp -> command
| CFdelete : id -> command
| CFlength : id -> id -> command
(*block*)
| CBalloc : id -> aexp -> command
| CBnew : id -> command
| CBappend : bkexp -> aexp -> command
| CBlookup : id -> bkexp -> aexp -> command
| CBlength : id -> bkexp -> command
| CBreplace : fexp -> aexp -> bkexp -> command
| CBtruncate : bkexp -> command
| CBdelete : bkexp -> command.
Notation " 'SKIP' " := CSkip.
Notation "x '::=' a" := (CAss x a) (at level 60).
Notation "c1 ;; c2" :=
(CSeq c1 c2) (at level 80, right associativity).
Notation "'WHILE' b 'DO' c 'END'" :=
(CWhile b c) (at level 80, right associativity).
Notation "'IFB' c1 'THEN' c2 'ELSE' c3 'FI'" :=
(CIf c1 c2 c3) (at level 80, right associativity).