src/Pure/ML/ml_compiler.ML
author haftmann
Mon, 08 Jun 2009 08:38:51 +0200
changeset 31483 88210717bfc8
parent 31428 3b32a57b044b
child 31477 ae1a00e1a2f6
permissions -rw-r--r--
added generator for char and trivial generator for String.literal

(*  Title:      Pure/ML/ml_compiler.ML
    Author:     Makarius

Runtime compilation -- generic version.
*)

signature ML_COMPILER =
sig
  val exception_position: exn -> Position.T
  val eval: bool -> Position.T -> ML_Lex.token list -> unit
end

structure ML_Compiler: ML_COMPILER =
struct

fun exception_position _ = Position.none;

fun eval verbose pos toks =
  let
    val line = the_default 1 (Position.line_of pos);
    val file = the_default "ML" (Position.file_of pos);
    val text = ML_Lex.flatten toks;
  in Secure.use_text ML_Env.local_context (line, file) verbose text end;

end;