src/Pure/ML/ml_compiler.ML
author wenzelm
Mon, 30 Aug 2010 15:09:20 +0200
changeset 38874 4a4d34d2f97b
parent 31477 ae1a00e1a2f6
child 44270 3eaad39e520c
permissions -rw-r--r--
more careful treatment of nested multi-exceptions, collapsing cumulatively empty list to Interrupt;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
31333
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
     1
(*  Title:      Pure/ML/ml_compiler.ML
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
     2
    Author:     Makarius
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
     3
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
     4
Runtime compilation -- generic version.
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
     5
*)
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
     6
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
     7
signature ML_COMPILER =
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
     8
sig
31477
ae1a00e1a2f6 added exn_message (formerly in toplevel.ML);
wenzelm
parents: 31428
diff changeset
     9
  val exn_position: exn -> Position.T
38874
4a4d34d2f97b more careful treatment of nested multi-exceptions, collapsing cumulatively empty list to Interrupt;
wenzelm
parents: 31477
diff changeset
    10
  val exn_messages: exn -> string list
31477
ae1a00e1a2f6 added exn_message (formerly in toplevel.ML);
wenzelm
parents: 31428
diff changeset
    11
  val exn_message: exn -> string
31333
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    12
  val eval: bool -> Position.T -> ML_Lex.token list -> unit
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    13
end
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    14
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    15
structure ML_Compiler: ML_COMPILER =
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    16
struct
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    17
31477
ae1a00e1a2f6 added exn_message (formerly in toplevel.ML);
wenzelm
parents: 31428
diff changeset
    18
fun exn_position _ = Position.none;
38874
4a4d34d2f97b more careful treatment of nested multi-exceptions, collapsing cumulatively empty list to Interrupt;
wenzelm
parents: 31477
diff changeset
    19
val exn_messages = Runtime.exn_messages exn_position;
31477
ae1a00e1a2f6 added exn_message (formerly in toplevel.ML);
wenzelm
parents: 31428
diff changeset
    20
val exn_message = Runtime.exn_message exn_position;
31428
3b32a57b044b added exception_position (dummy);
wenzelm
parents: 31333
diff changeset
    21
31333
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    22
fun eval verbose pos toks =
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    23
  let
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    24
    val line = the_default 1 (Position.line_of pos);
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    25
    val file = the_default "ML" (Position.file_of pos);
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    26
    val text = ML_Lex.flatten toks;
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    27
  in Secure.use_text ML_Env.local_context (line, file) verbose text end;
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    28
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    29
end;
fcd010617e6c added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
wenzelm
parents:
diff changeset
    30