| author | haftmann | 
| Wed, 11 Aug 2010 08:59:41 +0200 | |
| changeset 38339 | fb8fd73827d4 | 
| parent 31477 | ae1a00e1a2f6 | 
| child 38874 | 4a4d34d2f97b | 
| permissions | -rw-r--r-- | 
| 
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 | 9  | 
val exn_position: exn -> Position.T  | 
10  | 
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
 | 
11  | 
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
 | 
12  | 
end  | 
| 
 
fcd010617e6c
added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
 
wenzelm 
parents:  
diff
changeset
 | 
13  | 
|
| 
 
fcd010617e6c
added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
 
wenzelm 
parents:  
diff
changeset
 | 
14  | 
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
 | 
15  | 
struct  | 
| 
 
fcd010617e6c
added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
 
wenzelm 
parents:  
diff
changeset
 | 
16  | 
|
| 31477 | 17  | 
fun exn_position _ = Position.none;  | 
18  | 
val exn_message = Runtime.exn_message exn_position;  | 
|
| 31428 | 19  | 
|
| 
31333
 
fcd010617e6c
added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
 
wenzelm 
parents:  
diff
changeset
 | 
20  | 
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
 | 
21  | 
let  | 
| 
 
fcd010617e6c
added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
 
wenzelm 
parents:  
diff
changeset
 | 
22  | 
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
 | 
23  | 
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
 | 
24  | 
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
 | 
25  | 
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
 | 
26  | 
|
| 
 
fcd010617e6c
added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
 
wenzelm 
parents:  
diff
changeset
 | 
27  | 
end;  | 
| 
 
fcd010617e6c
added structure ML_Compiler: runtime compilation, with advanced version for Poly/ML 5.3 (formerly ML_Test);
 
wenzelm 
parents:  
diff
changeset
 | 
28  |