equal
deleted
inserted
replaced
15 -> (CodeThingol.code -> CodeThingol.typscheme * CodeThingol.iterm |
15 -> (CodeThingol.code -> CodeThingol.typscheme * CodeThingol.iterm |
16 -> string list -> term -> 'a) |
16 -> string list -> term -> 'a) |
17 -> term -> 'a; |
17 -> term -> 'a; |
18 val satisfies_ref: (unit -> bool) option ref; |
18 val satisfies_ref: (unit -> bool) option ref; |
19 val satisfies: theory -> term -> string list -> bool; |
19 val satisfies: theory -> term -> string list -> bool; |
20 val codegen_command: theory -> string -> unit; |
20 val codegen_shell_command: string (*theory name*) -> string (*cg expr*) -> unit; |
21 end; |
21 end; |
22 |
22 |
23 structure CodePackage : CODE_PACKAGE = |
23 structure CodePackage : CODE_PACKAGE = |
24 struct |
24 struct |
25 |
25 |
263 |
263 |
264 val _ = |
264 val _ = |
265 OuterSyntax.command codeK "generate executable code for constants" |
265 OuterSyntax.command codeK "generate executable code for constants" |
266 K.diag (P.!!! (code_exprP code_cmd) >> (fn f => Toplevel.keep (f o Toplevel.theory_of))); |
266 K.diag (P.!!! (code_exprP code_cmd) >> (fn f => Toplevel.keep (f o Toplevel.theory_of))); |
267 |
267 |
268 fun codegen_command thy cmd = |
268 fun codegen_shell_command thyname cmd = Isar.toplevel (fn _ => |
269 case Scan.read OuterLex.stopper (P.!!! (code_exprP code_cmd)) ((filter OuterLex.is_proper o OuterSyntax.scan) cmd) |
269 (use_thy thyname; case Scan.read OuterLex.stopper (P.!!! (code_exprP code_cmd)) ((filter OuterLex.is_proper o OuterSyntax.scan) cmd) |
270 of SOME f => (writeln "Now generating code..."; f thy) |
270 of SOME f => (writeln "Now generating code..."; f (theory thyname)) |
271 | NONE => error ("Bad directive " ^ quote cmd); |
271 | NONE => error ("Bad directive " ^ quote cmd))) |
|
272 handle TOPLEVEL_ERROR => OS.Process.exit OS.Process.failure; |
272 |
273 |
273 val _ = |
274 val _ = |
274 OuterSyntax.improper_command code_thmsK "print system of defining equations for code" OuterKeyword.diag |
275 OuterSyntax.improper_command code_thmsK "print system of defining equations for code" OuterKeyword.diag |
275 (Scan.repeat P.term |
276 (Scan.repeat P.term |
276 >> (fn cs => Toplevel.no_timing o Toplevel.unknown_theory |
277 >> (fn cs => Toplevel.no_timing o Toplevel.unknown_theory |