src/Pure/pure_syn.ML
author wenzelm
Tue Mar 18 15:29:58 2014 +0100 (2014-03-18 ago)
changeset 56204 f70e69208a8c
parent 55828 42ac3cfb89f6
child 56208 06cc31dff138
permissions -rw-r--r--
more antiquotations;
wenzelm@48879
     1
(*  Title:      Pure/pure_syn.ML
wenzelm@48879
     2
    Author:     Makarius
wenzelm@48879
     3
wenzelm@52546
     4
Minimal outer syntax for bootstrapping Isabelle/Pure.
wenzelm@48879
     5
*)
wenzelm@48879
     6
wenzelm@48879
     7
structure Pure_Syn: sig end =
wenzelm@48879
     8
struct
wenzelm@48879
     9
wenzelm@48879
    10
val _ =
wenzelm@48879
    11
  Outer_Syntax.command
wenzelm@56204
    12
    (("theory", Keyword.tag_theory Keyword.thy_begin), @{here}) "begin theory"
wenzelm@48879
    13
    (Thy_Header.args >> (fn header =>
wenzelm@48879
    14
      Toplevel.print o
wenzelm@48879
    15
        Toplevel.init_theory
wenzelm@54450
    16
          (fn () => Thy_Info.toplevel_begin_theory (! ProofGeneral.master_path) header)));
wenzelm@48879
    17
wenzelm@48879
    18
val _ =
wenzelm@48879
    19
  Outer_Syntax.command
wenzelm@56204
    20
    (("ML_file", Keyword.tag_ml Keyword.thy_load), @{here}) "ML text from file"
wenzelm@48905
    21
    (Thy_Load.parse_files "ML_file" >> (fn files => Toplevel.generic_theory (fn gthy =>
wenzelm@48879
    22
        let
wenzelm@55788
    23
          val [{src_path, lines, digest, pos}] = files (Context.theory_of gthy);
wenzelm@55788
    24
          val provide = Thy_Load.provide (src_path, digest);
wenzelm@55828
    25
          val source = {delimited = true, text = cat_lines lines, pos = pos};
wenzelm@48879
    26
        in
wenzelm@48879
    27
          gthy
wenzelm@55828
    28
          |> ML_Context.exec (fn () => ML_Context.eval_source true source)
wenzelm@48879
    29
          |> Local_Theory.propagate_ml_env
wenzelm@48879
    30
          |> Context.mapping provide (Local_Theory.background_theory provide)
wenzelm@48879
    31
        end)));
wenzelm@48879
    32
wenzelm@48879
    33
end;
wenzelm@48879
    34