src/Pure/ML/ml_compiler.ML
changeset 56618 874bdedb2313
parent 56304 40274e4f5ebf
child 60858 7bf2188a0998
equal deleted inserted replaced
56617:c00646996701 56618:874bdedb2313
     4 Runtime compilation and evaluation -- generic version.
     4 Runtime compilation and evaluation -- generic version.
     5 *)
     5 *)
     6 
     6 
     7 signature ML_COMPILER =
     7 signature ML_COMPILER =
     8 sig
     8 sig
     9   type flags = {SML: bool, redirect: bool, verbose: bool}
     9   type flags = {SML: bool, exchange: bool, redirect: bool, verbose: bool}
    10   val flags: flags
    10   val flags: flags
    11   val verbose: bool -> flags -> flags
    11   val verbose: bool -> flags -> flags
    12   val eval: flags -> Position.T -> ML_Lex.token list -> unit
    12   val eval: flags -> Position.T -> ML_Lex.token list -> unit
    13 end
    13 end
    14 
    14 
    15 structure ML_Compiler: ML_COMPILER =
    15 structure ML_Compiler: ML_COMPILER =
    16 struct
    16 struct
    17 
    17 
    18 type flags = {SML: bool, redirect: bool, verbose: bool};
    18 type flags = {SML: bool, exchange: bool, redirect: bool, verbose: bool};
    19 val flags = {SML = false, redirect = false, verbose = false};
    19 val flags = {SML = false, exchange = false, redirect = false, verbose = false};
    20 fun verbose v (flags: flags) = {SML = #SML flags, redirect = #redirect flags, verbose = v};
    20 
       
    21 fun verbose b (flags: flags) =
       
    22   {SML = #SML flags, exchange = #exchange flags, redirect = #redirect flags, verbose = b};
    21 
    23 
    22 fun eval (flags: flags) pos toks =
    24 fun eval (flags: flags) pos toks =
    23   let
    25   let
    24     val _ = if #SML flags then error ("Standard ML is unsupported on " ^ ML_System.name) else ();
    26     val _ = if #SML flags then error ("Standard ML is unsupported on " ^ ML_System.name) else ();
    25     val line = the_default 1 (Position.line_of pos);
    27     val line = the_default 1 (Position.line_of pos);