src/Pure/ML/ml_context.ML
author wenzelm
Sat, 29 Mar 2008 19:14:14 +0100
changeset 26492 6e87cc839632
parent 26473 2266e5fd7b63
child 26658 5967c2a0a94f
permissions -rw-r--r--
removed obsolete store_thm(s), cf. functional versions in pure_thy.ML; tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
24581
6491d89ba76c tuned comments;
wenzelm
parents: 24574
diff changeset
     1
(*  Title:      Pure/ML/ml_context.ML
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
     2
    ID:         $Id$
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
     3
    Author:     Makarius
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
     4
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
     5
ML context and antiquotations.
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
     6
*)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
     7
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
     8
signature BASIC_ML_CONTEXT =
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
     9
sig
26416
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    10
  val bind_thm: string * thm -> unit
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    11
  val bind_thms: string * thm list -> unit
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    12
  val thm: xstring -> thm
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    13
  val thms: xstring -> thm list
25204
36cf92f63a44 replaced Secure.evaluate by ML_Context.evaluate;
wenzelm
parents: 25142
diff changeset
    14
end
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    15
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    16
signature ML_CONTEXT =
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    17
sig
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    18
  include BASIC_ML_CONTEXT
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    19
  val the_generic_context: unit -> Context.generic
26432
095e448b95a0 renamed ML_Context.the_context to ML_Context.the_global_context;
wenzelm
parents: 26416
diff changeset
    20
  val the_global_context: unit -> theory
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    21
  val the_local_context: unit -> Proof.context
26455
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
    22
  val exec: (unit -> unit) -> Context.generic -> Context.generic
26416
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    23
  val stored_thms: thm list ref
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    24
  val ml_store_thm: string * thm -> unit
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    25
  val ml_store_thms: string * thm list -> unit
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    26
  val add_keywords: string list -> unit
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    27
  val inline_antiq: string ->
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    28
    (Context.generic * Args.T list -> string * (Context.generic * Args.T list)) -> unit
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    29
  val value_antiq: string ->
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    30
    (Context.generic * Args.T list -> (string * string) * (Context.generic * Args.T list)) -> unit
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    31
  val proj_value_antiq: string -> (Context.generic * Args.T list ->
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    32
      (string * string * string) * (Context.generic * Args.T list)) -> unit
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
    33
  val eval_antiquotes_fn: (string -> string * Position.T -> string * string) ref  (* FIXME tmp *)
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    34
  val trace: bool ref
26455
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
    35
  val eval: bool -> Position.T -> string -> unit
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
    36
  val eval_file: Path.T -> unit
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
    37
  val eval_in: Context.generic option -> bool -> Position.T -> string -> unit
25204
36cf92f63a44 replaced Secure.evaluate by ML_Context.evaluate;
wenzelm
parents: 25142
diff changeset
    38
  val evaluate: (string -> unit) * (string -> 'b) -> bool ->
36cf92f63a44 replaced Secure.evaluate by ML_Context.evaluate;
wenzelm
parents: 25142
diff changeset
    39
    string * (unit -> 'a) option ref -> string -> 'a
26455
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
    40
  val expression: Position.T -> string -> string -> string -> Context.generic -> Context.generic
25204
36cf92f63a44 replaced Secure.evaluate by ML_Context.evaluate;
wenzelm
parents: 25142
diff changeset
    41
end
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    42
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    43
structure ML_Context: ML_CONTEXT =
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    44
struct
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    45
26416
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    46
(** implicit ML context **)
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    47
26416
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    48
val the_generic_context = Context.the_thread_data;
26432
095e448b95a0 renamed ML_Context.the_context to ML_Context.the_global_context;
wenzelm
parents: 26416
diff changeset
    49
val the_global_context = Context.theory_of o the_generic_context;
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    50
val the_local_context = Context.proof_of o the_generic_context;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    51
26455
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
    52
fun exec (e: unit -> unit) context =
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
    53
  (case Context.setmp_thread_data (SOME context) (fn () => (e (); Context.thread_data ())) () of
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
    54
    SOME context' => context'
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
    55
  | NONE => error "Missing context after execution");
26416
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    56
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    57
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    58
(* theorem bindings *)
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    59
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    60
val stored_thms: thm list ref = ref [];
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    61
26492
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    62
fun ml_store sel (name, ths) =
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    63
  let
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    64
    val ths' = Context.>>> (Context.map_theory_result (PureThy.store_thms (name, ths)));
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    65
    val _ =
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    66
      if name = "" then ()
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    67
      else if not (ML_Syntax.is_identifier name) then
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    68
        error ("Cannot bind theorem(s) " ^ quote name ^ " as ML value")
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    69
      else setmp stored_thms ths' (fn () =>
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    70
        use_text (0, "") Output.ml_output true
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    71
          ("val " ^ name ^ " = " ^ sel ^ "(! ML_Context.stored_thms);")) ();
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    72
  in () end;
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    73
26492
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    74
val ml_store_thms = ml_store "";
6e87cc839632 removed obsolete store_thm(s), cf. functional versions in pure_thy.ML;
wenzelm
parents: 26473
diff changeset
    75
fun ml_store_thm (name, th) = ml_store "hd" (name, [th]);
26416
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    76
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    77
fun bind_thm (name, thm) = ml_store_thm (name, Drule.standard thm);
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
    78
fun bind_thms (name, thms) = ml_store_thms (name, map Drule.standard thms);
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    79
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    80
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    81
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    82
(** ML antiquotations **)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    83
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    84
(* maintain keywords *)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    85
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    86
val global_lexicon = ref Scan.empty_lexicon;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    87
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    88
fun add_keywords keywords = CRITICAL (fn () =>
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    89
  change global_lexicon (Scan.extend_lexicon (map Symbol.explode keywords)));
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    90
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    91
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    92
(* maintain commands *)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    93
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    94
datatype antiq = Inline of string | ProjValue of string * string * string;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    95
val global_parsers = ref (Symtab.empty:
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    96
  (Context.generic * Args.T list -> antiq * (Context.generic * Args.T list)) Symtab.table);
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    97
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    98
local
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
    99
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   100
fun add_item kind name scan = CRITICAL (fn () =>
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   101
  change global_parsers (fn tab =>
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   102
   (if not (Symtab.defined tab name) then ()
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   103
    else warning ("Redefined ML antiquotation: " ^ quote name);
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   104
    Symtab.update (name, scan >> kind) tab)));
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   105
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   106
in
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   107
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   108
val inline_antiq = add_item Inline;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   109
val proj_value_antiq = add_item ProjValue;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   110
fun value_antiq name scan = proj_value_antiq name (scan >> (fn (a, s) => (a, s, "")));
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   111
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   112
end;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   113
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   114
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   115
(* command syntax *)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   116
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   117
fun syntax scan src =
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   118
  #1 (Args.context_syntax "ML antiquotation" scan src (the_local_context ()));
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   119
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   120
fun command src =
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   121
  let val ((name, _), pos) = Args.dest_src src in
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   122
    (case Symtab.lookup (! global_parsers) name of
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   123
      NONE => error ("Unknown ML antiquotation command: " ^ quote name ^ Position.str_of pos)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   124
    | SOME scan => syntax scan src)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   125
  end;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   126
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   127
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   128
(* outer syntax *)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   129
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   130
structure T = OuterLex;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   131
structure P = OuterParse;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   132
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   133
val antiq =
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   134
  P.!!! (P.position P.xname -- P.arguments --| Scan.ahead P.eof)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   135
  >> (fn ((x, pos), y) => Args.src ((x, y), pos));
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   136
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   137
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   138
(* input/output wrappers *)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   139
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   140
local
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   141
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   142
fun eval_antiquotes struct_name txt_pos =
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   143
  let
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   144
    val lex = ! global_lexicon;
26385
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   145
    val ants = Antiquote.scan_antiquotes txt_pos;
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   146
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   147
    fun expand (Antiquote.Text s) names = (("", Symbol.escape s), names)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   148
      | expand (Antiquote.Antiq x) names =
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   149
          (case command (Antiquote.scan_arguments lex antiq x) of
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   150
            Inline s => (("", s), names)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   151
          | ProjValue (a, s, f) =>
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   152
              let
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   153
                val a' = if ML_Syntax.is_identifier a then a else "val";
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   154
                val ([b], names') = Name.variants [a'] names;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   155
                val binding = "val " ^ b ^ " = " ^ s ^ ";\n";
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   156
                val value =
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   157
                  if f = "" then struct_name ^ "." ^ b
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   158
                  else "(" ^ f ^ " " ^ struct_name ^ "." ^ b ^ ")";
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   159
              in ((binding, value), names') end);
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   160
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   161
    val (decls, body) =
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   162
      fold_map expand ants ML_Syntax.reserved
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   163
      |> #1 |> split_list |> pairself implode;
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   164
  in ("structure " ^ struct_name ^ " =\nstruct\n" ^ decls ^ "end;", body) end;
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   165
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   166
in
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   167
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   168
val eval_antiquotes_fn = ref eval_antiquotes;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   169
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   170
val trace = ref false;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   171
26385
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   172
fun eval_wrapper pr verbose pos txt =
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   173
  let
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   174
    val struct_name =
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   175
      if Multithreading.available then "Isabelle" ^ serial_string ()
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   176
      else "Isabelle";
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   177
    val (txt1, txt2) = ! eval_antiquotes_fn struct_name (txt, pos);  (* FIXME tmp hook *)
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   178
    val _ = if ! trace then tracing (cat_lines [txt1, txt2]) else ();
26385
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   179
    fun eval p =
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   180
      use_text (the_default 1 (Position.line_of p), the_default "ML" (Position.file_of p)) pr;
25755
9bc082c2cc92 eval_wrapper: CRITICAL;
wenzelm
parents: 25700
diff changeset
   181
  in
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   182
    eval Position.none false txt1;
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   183
    eval pos verbose txt2;
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   184
    forget_structure struct_name
25755
9bc082c2cc92 eval_wrapper: CRITICAL;
wenzelm
parents: 25700
diff changeset
   185
  end;
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   186
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   187
end;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   188
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   189
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   190
(* ML evaluation *)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   191
26455
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
   192
val eval = eval_wrapper Output.ml_output;
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
   193
fun eval_file path = eval true (Position.path path) (File.read path);
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   194
26455
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
   195
fun eval_in context verbose pos txt =
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
   196
  Context.setmp_thread_data context (fn () => eval verbose pos txt) ();
25204
36cf92f63a44 replaced Secure.evaluate by ML_Context.evaluate;
wenzelm
parents: 25142
diff changeset
   197
25700
185ea28035ac named some critical sections;
wenzelm
parents: 25346
diff changeset
   198
fun evaluate pr verbose (ref_name, r) txt = NAMED_CRITICAL "ML" (fn () =>
25204
36cf92f63a44 replaced Secure.evaluate by ML_Context.evaluate;
wenzelm
parents: 25142
diff changeset
   199
  let
36cf92f63a44 replaced Secure.evaluate by ML_Context.evaluate;
wenzelm
parents: 25142
diff changeset
   200
    val _ = r := NONE;
26385
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   201
    val _ = eval_wrapper pr verbose Position.none
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   202
      ("val _ = (" ^ ref_name ^ " := SOME (fn () => " ^ txt ^ "))");
25204
36cf92f63a44 replaced Secure.evaluate by ML_Context.evaluate;
wenzelm
parents: 25142
diff changeset
   203
  in (case ! r of NONE => error ("Bad evaluation for " ^ ref_name) | SOME e => e) end) ();
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   204
26455
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
   205
fun expression pos bind body txt =
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
   206
  exec (fn () => eval false pos
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
   207
    ("Context.set_thread_data (SOME (let " ^ bind ^ " = " ^ txt ^ " in " ^ body ^
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
   208
      " end (ML_Context.the_generic_context ())));"));
1757a6e049f4 reorganized signature of ML_Context;
wenzelm
parents: 26432
diff changeset
   209
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   210
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   211
(* basic antiquotations *)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   212
26385
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   213
fun context x = (Scan.state >> Context.proof_of) x;
25142
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   214
26385
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   215
local
25142
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   216
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   217
val _ = value_antiq "context" (Scan.succeed ("context", "ML_Context.the_local_context ()"));
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   218
25142
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   219
val _ = inline_antiq "sort" (context -- Scan.lift Args.name >> (fn (ctxt, s) =>
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   220
  ML_Syntax.atomic (ML_Syntax.print_sort (Syntax.read_sort ctxt s))));
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   221
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   222
val _ = inline_antiq "typ" (Args.typ >> (ML_Syntax.atomic o ML_Syntax.print_typ));
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   223
val _ = inline_antiq "term" (Args.term >> (ML_Syntax.atomic o ML_Syntax.print_term));
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   224
val _ = inline_antiq "prop" (Args.prop >> (ML_Syntax.atomic o ML_Syntax.print_term));
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   225
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   226
val _ = value_antiq "ctyp" (Args.typ >> (fn T =>
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   227
  ("ctyp",
26432
095e448b95a0 renamed ML_Context.the_context to ML_Context.the_global_context;
wenzelm
parents: 26416
diff changeset
   228
    "Thm.ctyp_of (ML_Context.the_global_context ()) " ^ ML_Syntax.atomic (ML_Syntax.print_typ T))));
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   229
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   230
val _ = value_antiq "cterm" (Args.term >> (fn t =>
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   231
  ("cterm",
26432
095e448b95a0 renamed ML_Context.the_context to ML_Context.the_global_context;
wenzelm
parents: 26416
diff changeset
   232
    "Thm.cterm_of (ML_Context.the_global_context ()) " ^ ML_Syntax.atomic (ML_Syntax.print_term t))));
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   233
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   234
val _ = value_antiq "cprop" (Args.prop >> (fn t =>
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   235
  ("cprop",
26432
095e448b95a0 renamed ML_Context.the_context to ML_Context.the_global_context;
wenzelm
parents: 26416
diff changeset
   236
    "Thm.cterm_of (ML_Context.the_global_context ()) " ^ ML_Syntax.atomic (ML_Syntax.print_term t))));
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   237
25142
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   238
fun type_ syn = (context -- Scan.lift Args.name >> (fn (ctxt, c) =>
24695
2892482a4e62 added @{type_name};
wenzelm
parents: 24685
diff changeset
   239
    #1 (Term.dest_Type (ProofContext.read_tyname ctxt c))
25142
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   240
    |> syn ? Sign.base_name
24695
2892482a4e62 added @{type_name};
wenzelm
parents: 24685
diff changeset
   241
    |> ML_Syntax.print_string));
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   242
25142
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   243
val _ = inline_antiq "type_name" (type_ false);
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   244
val _ = inline_antiq "type_syntax" (type_ true);
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   245
26385
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   246
fun const syn = context -- Scan.lift Args.name >> (fn (ctxt, c) =>
25346
7f2e3292e3dd renamed ProofContext.read_const' to ProofContext.read_const_proper;
wenzelm
parents: 25334
diff changeset
   247
  #1 (Term.dest_Const (ProofContext.read_const_proper ctxt c))
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   248
  |> syn ? ProofContext.const_syntax_name ctxt
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   249
  |> ML_Syntax.print_string);
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   250
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   251
val _ = inline_antiq "const_name" (const false);
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   252
val _ = inline_antiq "const_syntax" (const true);
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   253
26188
9cb1b484fe96 added @{const} antiquotation;
wenzelm
parents: 25755
diff changeset
   254
val _ = inline_antiq "const"
26385
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   255
  (context -- Scan.lift Args.name --
26188
9cb1b484fe96 added @{const} antiquotation;
wenzelm
parents: 25755
diff changeset
   256
    Scan.optional (Scan.lift (Args.$$$ "(") |-- Args.enum1 "," Args.typ --| Scan.lift (Args.$$$ ")")) []
9cb1b484fe96 added @{const} antiquotation;
wenzelm
parents: 25755
diff changeset
   257
    >> (fn ((ctxt, c), Ts) =>
26473
2266e5fd7b63 eval_wrapper: non-critical version via unique Isabelle structure, proper forget_structure;
wenzelm
parents: 26455
diff changeset
   258
      let val (c, _) = Term.dest_Const (ProofContext.read_const_proper ctxt c)
26268
80aaf4d034be added mk_const functions
haftmann
parents: 26188
diff changeset
   259
      in ML_Syntax.atomic (ML_Syntax.print_term (ProofContext.mk_const ctxt (c, Ts))) end));
26188
9cb1b484fe96 added @{const} antiquotation;
wenzelm
parents: 25755
diff changeset
   260
25142
57c717b9dd59 added @{sort}, @{type_syntax} antiquotations;
wenzelm
parents: 24695
diff changeset
   261
in val _ = () end;
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   262
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   263
26416
a66f86ef7bb9 added store_thms etc. (formerly in Thy/thm_database.ML);
wenzelm
parents: 26405
diff changeset
   264
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   265
(** fact references **)
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   266
26346
17debd2fff8e simplified get_thm(s): back to plain name argument;
wenzelm
parents: 26336
diff changeset
   267
fun thm name = ProofContext.get_thm (the_local_context ()) name;
17debd2fff8e simplified get_thm(s): back to plain name argument;
wenzelm
parents: 26336
diff changeset
   268
fun thms name = ProofContext.get_thms (the_local_context ()) name;
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   269
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   270
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   271
local
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   272
26336
a0e2b706ce73 renamed datatype thmref to Facts.ref, tuned interfaces;
wenzelm
parents: 26268
diff changeset
   273
fun print_interval (Facts.FromTo arg) =
a0e2b706ce73 renamed datatype thmref to Facts.ref, tuned interfaces;
wenzelm
parents: 26268
diff changeset
   274
      "Facts.FromTo " ^ ML_Syntax.print_pair ML_Syntax.print_int ML_Syntax.print_int arg
a0e2b706ce73 renamed datatype thmref to Facts.ref, tuned interfaces;
wenzelm
parents: 26268
diff changeset
   275
  | print_interval (Facts.From i) = "Facts.From " ^ ML_Syntax.print_int i
a0e2b706ce73 renamed datatype thmref to Facts.ref, tuned interfaces;
wenzelm
parents: 26268
diff changeset
   276
  | print_interval (Facts.Single i) = "Facts.Single " ^ ML_Syntax.print_int i;
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   277
26368
3e74b09ce466 thm_antiq: produce error at runtime, not compile time;
wenzelm
parents: 26361
diff changeset
   278
fun thm_antiq kind get get_name = value_antiq kind
26385
ae7564661e76 ML runtime compilation: pass position, tuned signature;
wenzelm
parents: 26374
diff changeset
   279
  (context -- Scan.lift (Args.position Args.name -- Scan.option Args.thm_sel)
26374
be47e9a83b4f simplified thm_antiq;
wenzelm
parents: 26368
diff changeset
   280
  >> (fn (ctxt, ((name, pos), sel)) =>
26368
3e74b09ce466 thm_antiq: produce error at runtime, not compile time;
wenzelm
parents: 26361
diff changeset
   281
      let
26374
be47e9a83b4f simplified thm_antiq;
wenzelm
parents: 26368
diff changeset
   282
        val _ = get ctxt (Facts.Named ((name, pos), sel));
be47e9a83b4f simplified thm_antiq;
wenzelm
parents: 26368
diff changeset
   283
        val txt =
be47e9a83b4f simplified thm_antiq;
wenzelm
parents: 26368
diff changeset
   284
          "(Facts.Named ((" ^ ML_Syntax.print_string name ^ ", Position.none), " ^
be47e9a83b4f simplified thm_antiq;
wenzelm
parents: 26368
diff changeset
   285
            ML_Syntax.print_option (ML_Syntax.print_list print_interval) sel ^ "))";
be47e9a83b4f simplified thm_antiq;
wenzelm
parents: 26368
diff changeset
   286
      in (name, get_name ^ " (ML_Context.the_local_context ()) " ^ txt) end));
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   287
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   288
in
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   289
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   290
val _ = add_keywords ["(", ")", "-", ","];
26368
3e74b09ce466 thm_antiq: produce error at runtime, not compile time;
wenzelm
parents: 26361
diff changeset
   291
val _ = thm_antiq "thm" ProofContext.get_fact_single "ProofContext.get_fact_single";
3e74b09ce466 thm_antiq: produce error at runtime, not compile time;
wenzelm
parents: 26361
diff changeset
   292
val _ = thm_antiq "thms" ProofContext.get_fact "ProofContext.get_fact";
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   293
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   294
end;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   295
24685
c3d56f41483b tuned @{cpat};
wenzelm
parents: 24581
diff changeset
   296
val _ = proj_value_antiq "cpat" (Scan.lift Args.name >>
c3d56f41483b tuned @{cpat};
wenzelm
parents: 24581
diff changeset
   297
    (fn name => ("cpat",
26432
095e448b95a0 renamed ML_Context.the_context to ML_Context.the_global_context;
wenzelm
parents: 26416
diff changeset
   298
      "Thm.cterm_of (ML_Context.the_global_context ()) (Syntax.read_term \
24685
c3d56f41483b tuned @{cpat};
wenzelm
parents: 24581
diff changeset
   299
      \(ProofContext.set_mode ProofContext.mode_pattern (ML_Context.the_local_context ()))"
c3d56f41483b tuned @{cpat};
wenzelm
parents: 24581
diff changeset
   300
      ^ ML_Syntax.print_string name ^ ")", "")));
24574
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   301
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   302
end;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   303
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   304
structure Basic_ML_Context: BASIC_ML_CONTEXT = ML_Context;
e840872e9c7c moved ML_XXX.ML files to Pure/ML;
wenzelm
parents:
diff changeset
   305
open Basic_ML_Context;