author | haftmann |
Thu, 06 Oct 2022 14:16:39 +0000 | |
changeset 76251 | fbde7d1211fc |
parent 68815 | 6296915dee6e |
permissions | -rw-r--r-- |
62508
d0b68218ea55
discontinued RAW session: bootstrap directly from isabelle_process RAW_ML_SYSTEM;
wenzelm
parents:
62504
diff
changeset
|
1 |
(* Title: Pure/ML/ml_name_space.ML |
61715
5dc95d957569
speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
5dc95d957569
speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff
changeset
|
3 |
|
62853 | 4 |
ML name space, with initial entries for strict Standard ML. |
61715
5dc95d957569
speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff
changeset
|
5 |
*) |
5dc95d957569
speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff
changeset
|
6 |
|
62934 | 7 |
signature ML_NAME_SPACE = |
8 |
sig |
|
9 |
type T |
|
10 |
val global: T |
|
11 |
val global_values: (string * string) list -> T |
|
12 |
val forget_val: string -> unit |
|
13 |
val forget_type: string -> unit |
|
14 |
val forget_structure: string -> unit |
|
68815 | 15 |
val hidden_structures: string list |
62934 | 16 |
val bootstrap_values: string list |
17 |
val bootstrap_structures: string list |
|
18 |
val bootstrap_signatures: string list |
|
19 |
val sml_val: (string * PolyML.NameSpace.Values.value) list |
|
20 |
val sml_type: (string * PolyML.NameSpace.TypeConstrs.typeConstr) list |
|
21 |
val sml_fixity: (string * PolyML.NameSpace.Infixes.fixity) list |
|
22 |
val sml_structure: (string * PolyML.NameSpace.Structures.structureVal) list |
|
23 |
val sml_signature: (string * PolyML.NameSpace.Signatures.signatureVal) list |
|
24 |
val sml_functor: (string * PolyML.NameSpace.Functors.functorVal) list |
|
25 |
end; |
|
62819
d3ff367a16a0
careful export of type-dependent functions, without losing their special status;
wenzelm
parents:
62659
diff
changeset
|
26 |
|
62934 | 27 |
structure ML_Name_Space: ML_NAME_SPACE = |
28 |
struct |
|
61715
5dc95d957569
speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff
changeset
|
29 |
|
62934 | 30 |
type T = PolyML.NameSpace.nameSpace; |
62839
ea9f12e422c7
clarified SML name space: no access to structure PolyML;
wenzelm
parents:
62819
diff
changeset
|
31 |
|
ea9f12e422c7
clarified SML name space: no access to structure PolyML;
wenzelm
parents:
62819
diff
changeset
|
32 |
|
62934 | 33 |
(* global *) |
62839
ea9f12e422c7
clarified SML name space: no access to structure PolyML;
wenzelm
parents:
62819
diff
changeset
|
34 |
|
62934 | 35 |
val global = PolyML.globalNameSpace; |
36 |
fun global_values values : T = |
|
37 |
{lookupVal = #lookupVal global, |
|
38 |
lookupType = #lookupType global, |
|
39 |
lookupStruct = #lookupStruct global, |
|
40 |
lookupFix = #lookupFix global, |
|
41 |
lookupSig = #lookupSig global, |
|
42 |
lookupFunct = #lookupFunct global, |
|
43 |
enterVal = |
|
44 |
fn (x, value) => |
|
45 |
(case List.find (fn (y, _) => x = y) values of |
|
46 |
SOME (_, x') => #enterVal global (x', value) |
|
47 |
| NONE => ()), |
|
48 |
enterType = fn _ => (), |
|
49 |
enterFix = fn _ => (), |
|
50 |
enterStruct = fn _ => (), |
|
51 |
enterSig = fn _ => (), |
|
52 |
enterFunct = fn _ => (), |
|
53 |
allVal = #allVal global, |
|
54 |
allType = #allType global, |
|
55 |
allFix = #allFix global, |
|
56 |
allStruct = #allStruct global, |
|
57 |
allSig = #allSig global, |
|
58 |
allFunct = #allFunct global}; |
|
62875 | 59 |
|
60 |
||
62934 | 61 |
(* forget entries *) |
62 |
||
63 |
val forget_val = PolyML.Compiler.forgetValue; |
|
64 |
val forget_type = PolyML.Compiler.forgetType; |
|
65 |
val forget_structure = PolyML.Compiler.forgetStructure; |
|
66 |
||
68815 | 67 |
val hidden_structures = ["CInterface", "Foreign", "RunCall", "Signal"]; |
68 |
||
62934 | 69 |
|
70 |
(* bootstrap environment *) |
|
62860 | 71 |
|
62934 | 72 |
val bootstrap_values = |
73 |
["use", "exit", "ML_file", "ML_system_pretty", "ML_system_pp", "ML_system_overload", |
|
74 |
"chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph"]; |
|
75 |
val bootstrap_structures = |
|
76 |
["Exn", "Output_Primitives", "Basic_Exn", "Thread_Data", "Thread_Position", "ML_Recursive", |
|
77 |
"Private_Output", "PolyML"] @ hidden_structures; |
|
78 |
val bootstrap_signatures = |
|
79 |
["EXN", "OUTPUT_PRIMITIVES", "BASIC_EXN", "THREAD_DATA", "THREAD_POSITION", "ML_RECURSIVE", |
|
80 |
"PRIVATE_OUTPUT", "ML_NAME_SPACE"]; |
|
81 |
||
82 |
||
83 |
(* Standard ML environment *) |
|
84 |
||
85 |
val sml_val = |
|
86 |
List.filter (fn (a, _) => List.all (fn b => a <> b) bootstrap_values) (#allVal global ()); |
|
87 |
val sml_type = #allType global (); |
|
88 |
val sml_fixity = #allFix global (); |
|
89 |
val sml_structure = |
|
90 |
List.filter (fn (a, _) => List.all (fn b => a <> b) bootstrap_structures) (#allStruct global ()); |
|
91 |
val sml_signature = |
|
92 |
List.filter (fn (a, _) => List.all (fn b => a <> b) bootstrap_signatures) (#allSig global ()); |
|
93 |
val sml_functor = #allFunct global (); |
|
94 |
||
61715
5dc95d957569
speculative support for polyml-5.6, according to git commit 3527f4ba7b8b;
wenzelm
parents:
diff
changeset
|
95 |
end; |