src/Tools/Code/code_target.ML
changeset 64959 9ca021bd718d
parent 64957 3faa9b31ff78
child 66586 e5e56c330976
equal deleted inserted replaced
64958:85b87da722ab 64959:9ca021bd718d
    29 
    29 
    30   val generatedN: string
    30   val generatedN: string
    31   val compilation_text: Proof.context -> string -> Code_Thingol.program
    31   val compilation_text: Proof.context -> string -> Code_Thingol.program
    32     -> Code_Symbol.T list -> bool -> ((string * class list) list * Code_Thingol.itype) * Code_Thingol.iterm
    32     -> Code_Symbol.T list -> bool -> ((string * class list) list * Code_Thingol.itype) * Code_Thingol.iterm
    33     -> (string * string) list * string
    33     -> (string * string) list * string
       
    34   val compilation_text': Proof.context -> string -> string option -> Code_Thingol.program
       
    35     -> Code_Symbol.T list -> bool -> ((string * class list) list * Code_Thingol.itype) * Code_Thingol.iterm
       
    36     -> ((string * string) list * string) * (Code_Symbol.T -> string option)
    34 
    37 
    35   type serializer
    38   type serializer
    36   type literals = Code_Printer.literals
    39   type literals = Code_Printer.literals
    37   type language
    40   type language
    38   type ancestry
    41   type ancestry
   412       |> fold (curry (perhaps o try o
   415       |> fold (curry (perhaps o try o
   413           Code_Symbol.Graph.add_edge) Code_Symbol.value) syms;
   416           Code_Symbol.Graph.add_edge) Code_Symbol.value) syms;
   414     val (program_code, deresolve) =
   417     val (program_code, deresolve) =
   415       produce (mounted_serializer program (if all_public then [] else [Code_Symbol.value]));
   418       produce (mounted_serializer program (if all_public then [] else [Code_Symbol.value]));
   416     val value_name = the (deresolve Code_Symbol.value);
   419     val value_name = the (deresolve Code_Symbol.value);
   417   in (program_code, value_name) end;
   420   in ((program_code, value_name), deresolve) end;
   418 
   421 
   419 fun compilation_text ctxt target_name program syms =
   422 fun compilation_text' ctxt target_name some_module_name program syms =
   420   let
   423   let
   421     val (mounted_serializer, (_, prepared_program)) =
   424     val (mounted_serializer, (_, prepared_program)) =
   422       mount_serializer ctxt target_name NONE generatedN [] program syms;
   425       mount_serializer ctxt target_name NONE (the_default generatedN some_module_name) [] program syms;
   423   in
   426   in
   424     Code_Preproc.timed_exec "serializing"
   427     Code_Preproc.timed_exec "serializing"
   425     (fn () => dynamic_compilation_text mounted_serializer prepared_program syms) ctxt
   428     (fn () => dynamic_compilation_text mounted_serializer prepared_program syms) ctxt
   426   end;
   429   end;
   427 
   430 
       
   431 fun compilation_text ctxt target_name program syms =
       
   432   fst oo compilation_text' ctxt target_name NONE program syms
       
   433   
   428 end; (* local *)
   434 end; (* local *)
   429 
   435 
   430 
   436 
   431 (* code generation *)
   437 (* code generation *)
   432 
   438