48879
|
1 |
(* Title: Pure/pure_syn.ML
|
|
2 |
Author: Makarius
|
|
3 |
|
|
4 |
Minimal outer syntax for bootstrapping Pure.
|
|
5 |
*)
|
|
6 |
|
|
7 |
structure Pure_Syn: sig end =
|
|
8 |
struct
|
|
9 |
|
|
10 |
val _ =
|
|
11 |
Outer_Syntax.command
|
|
12 |
(("theory", Keyword.tag_theory Keyword.thy_begin), Position.none) "begin theory context"
|
|
13 |
(Thy_Header.args >> (fn header =>
|
|
14 |
Toplevel.print o
|
|
15 |
Toplevel.init_theory
|
|
16 |
(fn () => Thy_Info.toplevel_begin_theory (Thy_Load.get_master_path ()) header)));
|
|
17 |
|
|
18 |
val _ =
|
|
19 |
Outer_Syntax.command
|
|
20 |
(("ML_file", Keyword.tag_ml Keyword.thy_load), Position.none) "ML text from file"
|
48905
|
21 |
(Thy_Load.parse_files "ML_file" >> (fn files => Toplevel.generic_theory (fn gthy =>
|
48879
|
22 |
let
|
48905
|
23 |
val [{src_path, text, pos}] = files (Context.theory_of gthy);
|
|
24 |
val provide = Thy_Load.provide (src_path, SHA1.digest text);
|
48879
|
25 |
in
|
|
26 |
gthy
|
48905
|
27 |
|> ML_Context.exec (fn () => ML_Context.eval_text true pos text)
|
48879
|
28 |
|> Local_Theory.propagate_ml_env
|
|
29 |
|> Context.mapping provide (Local_Theory.background_theory provide)
|
|
30 |
end)));
|
|
31 |
|
|
32 |
end;
|
|
33 |
|