equal
deleted
inserted
replaced
168 val _ = |
168 val _ = |
169 Outer_Syntax.command \<^command_keyword>\<open>SML_export\<close> "evaluate SML within Isabelle/ML environment" |
169 Outer_Syntax.command \<^command_keyword>\<open>SML_export\<close> "evaluate SML within Isabelle/ML environment" |
170 (Parse.ML_source >> (fn source => |
170 (Parse.ML_source >> (fn source => |
171 let |
171 let |
172 val flags: ML_Compiler.flags = |
172 val flags: ML_Compiler.flags = |
173 {SML = true, exchange = true, redirect = false, verbose = true, |
173 {read = SOME ML_Env.SML, write = NONE, redirect = false, verbose = true, |
174 debug = NONE, writeln = writeln, warning = warning}; |
174 debug = NONE, writeln = writeln, warning = warning}; |
175 in |
175 in |
176 Toplevel.theory |
176 Toplevel.theory |
177 (Context.theory_map (ML_Context.exec (fn () => ML_Context.eval_source flags source))) |
177 (Context.theory_map (ML_Context.exec (fn () => ML_Context.eval_source flags source))) |
178 end)); |
178 end)); |
180 val _ = |
180 val _ = |
181 Outer_Syntax.command \<^command_keyword>\<open>SML_import\<close> "evaluate Isabelle/ML within SML environment" |
181 Outer_Syntax.command \<^command_keyword>\<open>SML_import\<close> "evaluate Isabelle/ML within SML environment" |
182 (Parse.ML_source >> (fn source => |
182 (Parse.ML_source >> (fn source => |
183 let |
183 let |
184 val flags: ML_Compiler.flags = |
184 val flags: ML_Compiler.flags = |
185 {SML = false, exchange = true, redirect = false, verbose = true, |
185 {read = NONE, write = SOME ML_Env.SML, redirect = false, verbose = true, |
186 debug = NONE, writeln = writeln, warning = warning}; |
186 debug = NONE, writeln = writeln, warning = warning}; |
187 in |
187 in |
188 Toplevel.generic_theory |
188 Toplevel.generic_theory |
189 (ML_Context.exec (fn () => ML_Context.eval_source flags source) #> |
189 (ML_Context.exec (fn () => ML_Context.eval_source flags source) #> |
190 Local_Theory.propagate_ml_env) |
190 Local_Theory.propagate_ml_env) |
194 Outer_Syntax.command ("ML_export", \<^here>) |
194 Outer_Syntax.command ("ML_export", \<^here>) |
195 "ML text within theory or local theory, and export to bootstrap environment" |
195 "ML text within theory or local theory, and export to bootstrap environment" |
196 (Parse.ML_source >> (fn source => |
196 (Parse.ML_source >> (fn source => |
197 Toplevel.generic_theory (fn context => |
197 Toplevel.generic_theory (fn context => |
198 context |
198 context |
199 |> ML_Env.set_global true |
199 |> Config.put_generic ML_Env.ML_write_global true |
200 |> ML_Context.exec (fn () => |
200 |> ML_Context.exec (fn () => |
201 ML_Context.eval_source (ML_Compiler.verbose true ML_Compiler.flags) source) |
201 ML_Context.eval_source (ML_Compiler.verbose true ML_Compiler.flags) source) |
202 |> ML_Env.restore_global context |
202 |> Config.put_generic ML_Env.ML_write_global |
|
203 (Config.get_generic context ML_Env.ML_write_global) |
203 |> Local_Theory.propagate_ml_env))); |
204 |> Local_Theory.propagate_ml_env))); |
204 |
205 |
205 val _ = |
206 val _ = |
206 Outer_Syntax.command \<^command_keyword>\<open>ML_prf\<close> "ML text within proof" |
207 Outer_Syntax.command \<^command_keyword>\<open>ML_prf\<close> "ML text within proof" |
207 (Parse.ML_source >> (fn source => |
208 (Parse.ML_source >> (fn source => |
1438 from conj show "PROP A" by (rule conjunctionD1) |
1439 from conj show "PROP A" by (rule conjunctionD1) |
1439 from conj show "PROP B" by (rule conjunctionD2) |
1440 from conj show "PROP B" by (rule conjunctionD2) |
1440 qed |
1441 qed |
1441 qed |
1442 qed |
1442 |
1443 |
|
1444 declare [[ML_write_global = false]] |
|
1445 |
1443 end |
1446 end |