Commit 8921730c authored by Léon Gondelman's avatar Léon Gondelman

mini-compiler:wip

parent 636415cf
......@@ -102,4 +102,9 @@ theory Imp
ceval mi body mj ->
ceval mj (Cwhile cond body) mf ->
ceval mi (Cwhile cond body) mf
lemma ceval_deterministic:
forall c mi mf1 mf2. ceval mi c mf1 -> ceval mi c mf2 -> mf1 = mf2
end
\ No newline at end of file
......@@ -151,9 +151,9 @@ theory Vm "Virtual Machine for IMP language"
(VMS (p + 1) (push m[x] s) m)
| trans_set_var:
forall c: code, p: pos, s: stack, x: id.
forall c: code, p: pos, x: id.
codeseq_at c p (isetvar x) ->
forall n:int, m: state.
forall n:int, s: stack, m: state.
transition c
(VMS p (push n s) m )
(VMS (p+1) s m[x<-n])
......@@ -185,41 +185,36 @@ theory Vm "Virtual Machine for IMP language"
| trans_beq:
forall c: code, p1 p2 ofs: pos, n1 n2: int.
forall c: code, p1 ofs: pos.
codeseq_at c p1 (ibeq ofs) ->
p2 = (if n1 = n2 then p1 + 1 + ofs else p1 + 1) ->
forall s:stack, m: state.
forall s:stack, m: state, n1 n2: int.
transition c
(VMS p1 (push n2 (push n1 s)) m)
(VMS p2 s m)
(VMS (if n1 = n2 then p1 + 1 + ofs else p1 + 1) s m)
| trans_bne:
forall c: code, p1 p2 ofs: pos, n1 n2: int.
forall c: code, p1 ofs: pos.
codeseq_at c p1 (ibne ofs) ->
p2 = (if n1 = n2 then p1 + 1 else p1 + 1 + ofs) ->
forall s:stack, m: state.
forall s:stack, m: state, n1 n2: int.
transition c
(VMS p1 (push n2 (push n1 s)) m)
(VMS p2 s m)
(VMS (if n1 = n2 then p1 + 1 else p1 + 1 + ofs) s m)
| trans_ble:
forall c: code, p1 p2 ofs: pos, n1 n2: int.
forall c: code, p1 ofs: pos.
codeseq_at c p1 (ible ofs) ->
p2 = (if n1 <= n2 then p1 + 1 + ofs else p1 + 1) ->
forall s:stack, m: state.
forall s:stack, m: state, n1 n2: int.
transition c
(VMS p1 (push n2 (push n1 s)) m)
(VMS p2 s m)
(VMS (if n1 <= n2 then p1 + 1 + ofs else p1 + 1) s m)
| trans_bgt:
forall c: code, p1 p2 ofs: pos, n1 n2: int.
forall c: code, p1 ofs: pos.
codeseq_at c p1 (ibgt ofs) ->
p2 = (if n1 <= n2 then p1 + 1 else p1 + 1 + ofs) ->
forall s:stack, m: state.
forall s:stack, m: state, n1 n2: int.
transition c
(VMS p1 (push n2 (push n1 s)) m)
(VMS p2 s m)
(VMS (if n1 <= n2 then p1 + 1 else p1 + 1 + ofs) s m)
| trans_branch:
forall c: code, p ofs: pos.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment