equal
deleted
inserted
replaced
5 Code generator interfaces and Isar setup. |
5 Code generator interfaces and Isar setup. |
6 *) |
6 *) |
7 |
7 |
8 signature CODE_PACKAGE = |
8 signature CODE_PACKAGE = |
9 sig |
9 sig |
|
10 val source_of: theory -> string -> string -> string list -> string; |
10 val evaluate_conv: theory |
11 val evaluate_conv: theory |
11 -> (term -> term * (CodeThingol.code -> CodeThingol.typscheme * CodeThingol.iterm |
12 -> (term -> term * (CodeThingol.code -> CodeThingol.typscheme * CodeThingol.iterm |
12 -> string list -> thm)) |
13 -> string list -> thm)) |
13 -> cterm -> thm; |
14 -> cterm -> thm; |
14 val evaluate_term: theory |
15 val evaluate_term: theory |
102 | SOME "-" => CodeTarget.write |
103 | SOME "-" => CodeTarget.write |
103 | SOME f => CodeTarget.file (Path.explode f) |
104 | SOME f => CodeTarget.file (Path.explode f) |
104 val _ = map (fn (((target, module), file), args) => |
105 val _ = map (fn (((target, module), file), args) => |
105 (mk_seri_dest file (CodeTarget.serialize thy target permissive module args code cs))) seris; |
106 (mk_seri_dest file (CodeTarget.serialize thy target permissive module args code cs))) seris; |
106 in () end; |
107 in () end; |
|
108 |
|
109 (* code retrieval *) |
|
110 |
|
111 fun source_of thy target module_name cs = |
|
112 let |
|
113 val (cs', _) = generate thy (CodeFuncgr.make thy cs) |
|
114 (fold_map ooo ensure_const) cs; |
|
115 val code = Program.get thy; |
|
116 in |
|
117 CodeTarget.string |
|
118 (CodeTarget.serialize thy target false (SOME module_name) [] code (SOME cs')) |
|
119 end; |
107 |
120 |
108 (* evaluation machinery *) |
121 (* evaluation machinery *) |
109 |
122 |
110 fun evaluate eval_kind thy evaluator = |
123 fun evaluate eval_kind thy evaluator = |
111 let |
124 let |