Skip to content

Commit 542f5d0

Browse files
myreenmktnk3
authored andcommitted
Compile a few example timeLang programs
1 parent 95b1e23 commit 542f5d0

12 files changed

+422
-38
lines changed

pancake/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ This is an example compilation of a TA program
6565
[ta_progs](ta_progs):
6666
Some sample timed automata (TA) programs.
6767

68+
[temp](temp):
69+
Temporary files
70+
6871
[timeLangScript.sml](timeLangScript.sml):
6972
Abstract syntax for timeLang
7073

pancake/crepLangScript.sml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Datatype:
2828
| Op binop (exp list)
2929
| Cmp cmp exp exp
3030
| Shift shift exp num
31+
| BaseAddr
3132
End
3233

3334
Datatype:

pancake/crep_to_loopScript.sml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ End
4242

4343

4444
Definition compile_exp_def:
45+
(compile_exp ctxt tmp l ((BaseAddr):'a crepLang$exp) = ([], BaseAddr, tmp, l)) /\
4546
(compile_exp ctxt tmp l ((Const c):'a crepLang$exp) = ([], Const c, tmp, l)) /\
4647
(compile_exp ctxt tmp l (Var v) = ([], Var (find_var ctxt v), tmp, l)) /\
4748
(compile_exp ctxt tmp l (Label f) = ([LocValue tmp (find_lab ctxt f)],

pancake/loopLangScript.sml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Datatype:
1616
| Load exp
1717
| Op binop (exp list)
1818
| Shift shift exp num
19+
| BaseAddr
1920
End
2021

2122
Datatype:

pancake/loop_liveScript.sml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ val _ = new_theory "loop_live";
1111
Definition vars_of_exp_def:
1212
vars_of_exp (loopLang$Var v) l = insert v () l ∧
1313
vars_of_exp (Const _) l = l ∧
14+
vars_of_exp (BaseAddr) l = l ∧
1415
vars_of_exp (Lookup _) l = l ∧
1516
vars_of_exp (Load a) l = vars_of_exp a l ∧
1617
vars_of_exp (Op x vs) l = vars_of_exp_list vs l ∧

pancake/loop_to_wordScript.sml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Definition comp_exp_def :
2828
(comp_exp ctxt (loopLang$Const w) = wordLang$Const w) /\
2929
(comp_exp ctxt (Var n) = Var (find_var ctxt n)) /\
3030
(comp_exp ctxt (Lookup m) = Lookup (Temp m)) /\
31+
(comp_exp ctxt (BaseAddr) = Lookup CurrHeap) /\
3132
(comp_exp ctxt (Load exp) = Load (comp_exp ctxt exp)) /\
3233
(comp_exp ctxt (Shift s exp n) = Shift s (comp_exp ctxt exp) n) /\
3334
(comp_exp ctxt (Op op wexps) =

pancake/panLangScript.sml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Datatype:
4444
| Op binop (exp list)
4545
| Cmp cmp exp exp
4646
| Shift shift exp num
47+
| BaseAddr
4748
End
4849

4950
Datatype:

pancake/pan_to_crepScript.sml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ Definition compile_exp_def:
7373
(compile_exp ctxt (Shift sh e n) =
7474
case FST (compile_exp ctxt e) of
7575
| [] => ([Const 0w], One)
76-
| e::es => ([Shift sh e n], One))
76+
| e::es => ([Shift sh e n], One)) /\
77+
(compile_exp ctxt BaseAddr = ([BaseAddr], One))
7778
Termination
7879
wf_rel_tac `measure (\e. panLang$exp_size ARB (SND e))` >>
7980
rpt strip_tac >>

pancake/temp/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Temporary files

0 commit comments

Comments
 (0)