src/Pure/pure_syn.ML
author wenzelm
Sat, 05 Apr 2014 15:03:40 +0200
changeset 56421 1ffd7eaa778b
parent 56304 40274e4f5ebf
child 56618 874bdedb2313
permissions -rw-r--r--
updated to jedit_build-20140405: Code2HTML.jar, CommonControls.jar, Console.jar, kappalayout.jar, Navigator.jar, SideKick.jar, doc with jEdit manuals (ant dist-manuals);
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
52546
7118524a2a24 tuned comments;
wenzelm
parents: 52455
diff changeset
     4
Minimal outer syntax for bootstrapping Isabelle/Pure.
48879
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
56204
f70e69208a8c more antiquotations;
wenzelm
parents: 55828
diff changeset
    12
    (("theory", Keyword.tag_theory Keyword.thy_begin), @{here}) "begin theory"
48879
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
54450
7815563f50dc tuned signature -- clarified Proof General legacy;
wenzelm
parents: 52546
diff changeset
    16
          (fn () => Thy_Info.toplevel_begin_theory (! ProofGeneral.master_path) header)));
48879
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
56204
f70e69208a8c more antiquotations;
wenzelm
parents: 55828
diff changeset
    20
    (("ML_file", Keyword.tag_ml Keyword.thy_load), @{here}) "ML text from file"
56208
06cc31dff138 clarifed module name;
wenzelm
parents: 56204
diff changeset
    21
    (Resources.parse_files "ML_file" >> (fn files => Toplevel.generic_theory (fn gthy =>
48879
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    22
        let
55788
67699e08e969 store blobs / inlined files as separate text lines: smaller values are more healthy for the Poly/ML RTS and allow implicit sharing;
wenzelm
parents: 54450
diff changeset
    23
          val [{src_path, lines, digest, pos}] = files (Context.theory_of gthy);
56208
06cc31dff138 clarifed module name;
wenzelm
parents: 56204
diff changeset
    24
          val provide = Resources.provide (src_path, digest);
55828
42ac3cfb89f6 clarified language markup: added "delimited" property;
wenzelm
parents: 55788
diff changeset
    25
          val source = {delimited = true, text = cat_lines lines, pos = pos};
56304
40274e4f5ebf redirect ML_Compiler reports more directly: only the (big) parse tree report is deferred via Execution.print (NB: this does not work for asynchronous "diag" commands);
wenzelm
parents: 56275
diff changeset
    26
          val flags = {SML = false, redirect = true, verbose = true};
48879
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    27
        in
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    28
          gthy
56304
40274e4f5ebf redirect ML_Compiler reports more directly: only the (big) parse tree report is deferred via Execution.print (NB: this does not work for asynchronous "diag" commands);
wenzelm
parents: 56275
diff changeset
    29
          |> ML_Context.exec (fn () => ML_Context.eval_source flags source)
48879
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    30
          |> Local_Theory.propagate_ml_env
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    31
          |> Context.mapping provide (Local_Theory.background_theory provide)
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    32
        end)));
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    33
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    34
end;
cb5cdbb645cd clarified bootstrapping of Pure;
wenzelm
parents:
diff changeset
    35