src/Pure/pure_syn.ML
author wenzelm
Tue, 21 May 2013 18:03:36 +0200
changeset 52105 88b423034d4f
parent 48905 04576657cf94
child 52455 9a8f4fdac3cf
permissions -rw-r--r--
proper options; tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48879
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/pure_syn.ML
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
     3
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
     4
Minimal outer syntax for bootstrapping Pure.
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
     5
*)
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
     6
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
     7
structure Pure_Syn: sig end =
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
     8
struct
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
     9
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    10
val _ =
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    11
  Outer_Syntax.command
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    12
    (("theory", Keyword.tag_theory Keyword.thy_begin), Position.none) "begin theory context"
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    13
    (Thy_Header.args >> (fn header =>
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    14
      Toplevel.print o
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    15
        Toplevel.init_theory
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    16
          (fn () => Thy_Info.toplevel_begin_theory (Thy_Load.get_master_path ()) header)));
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    17
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    18
val _ =
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    19
  Outer_Syntax.command
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    20
    (("ML_file", Keyword.tag_ml Keyword.thy_load), Position.none) "ML text from file"
48905
04576657cf94 clarified type Token.file;
wenzelm
parents: 48896
diff changeset
    21
    (Thy_Load.parse_files "ML_file" >> (fn files => Toplevel.generic_theory (fn gthy =>
48879
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    22
        let
48905
04576657cf94 clarified type Token.file;
wenzelm
parents: 48896
diff changeset
    23
          val [{src_path, text, pos}] = files (Context.theory_of gthy);
04576657cf94 clarified type Token.file;
wenzelm
parents: 48896
diff changeset
    24
          val provide = Thy_Load.provide (src_path, SHA1.digest text);
48879
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    25
        in
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    26
          gthy
48905
04576657cf94 clarified type Token.file;
wenzelm
parents: 48896
diff changeset
    27
          |> ML_Context.exec (fn () => ML_Context.eval_text true pos text)
48879
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    28
          |> Local_Theory.propagate_ml_env
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    29
          |> Context.mapping provide (Local_Theory.background_theory provide)
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    30
        end)));
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    31
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    32
end;
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    33