src/Pure/codegen.ML
changeset 26939 1035c89b4c02
parent 26931 aa226d8405a8
child 26974 83adc1eaeaab
equal deleted inserted replaced
26938:64e850c3da9e 26939:1035c89b4c02
   580   error (s ^ "\nrequired by:\n" ^ commas (Graph.all_succs gr [dep]));
   580   error (s ^ "\nrequired by:\n" ^ commas (Graph.all_succs gr [dep]));
   581 
   581 
   582 fun invoke_codegen thy defs dep module brack (gr, t) = (case get_first
   582 fun invoke_codegen thy defs dep module brack (gr, t) = (case get_first
   583    (fn (_, f) => f thy defs gr dep module brack t) (#codegens (CodegenData.get thy)) of
   583    (fn (_, f) => f thy defs gr dep module brack t) (#codegens (CodegenData.get thy)) of
   584       NONE => codegen_error gr dep ("Unable to generate code for term:\n" ^
   584       NONE => codegen_error gr dep ("Unable to generate code for term:\n" ^
   585         Sign.string_of_term thy t)
   585         Syntax.string_of_term_global thy t)
   586     | SOME x => x);
   586     | SOME x => x);
   587 
   587 
   588 fun invoke_tycodegen thy defs dep module brack (gr, T) = (case get_first
   588 fun invoke_tycodegen thy defs dep module brack (gr, T) = (case get_first
   589    (fn (_, f) => f thy defs gr dep module brack T) (#tycodegens (CodegenData.get thy)) of
   589    (fn (_, f) => f thy defs gr dep module brack T) (#tycodegens (CodegenData.get thy)) of
   590       NONE => codegen_error gr dep ("Unable to generate code for type:\n" ^
   590       NONE => codegen_error gr dep ("Unable to generate code for type:\n" ^
   591         Sign.string_of_typ thy T)
   591         Syntax.string_of_typ_global thy T)
   592     | SOME x => x);
   592     | SOME x => x);
   593 
   593 
   594 
   594 
   595 (**** code generator for mixfix expressions ****)
   595 (**** code generator for mixfix expressions ****)
   596 
   596 
   985     val gi' = ObjectLogic.atomize_term thy (map_types
   985     val gi' = ObjectLogic.atomize_term thy (map_types
   986       (map_type_tfree (fn p as (s, S) =>
   986       (map_type_tfree (fn p as (s, S) =>
   987         let val T = the_default (the_default (TFree p) default_type)
   987         let val T = the_default (the_default (TFree p) default_type)
   988           (AList.lookup (op =) tvinsts s)
   988           (AList.lookup (op =) tvinsts s)
   989         in if Sign.of_sort thy (T, S) then T
   989         in if Sign.of_sort thy (T, S) then T
   990           else error ("Type " ^ Sign.string_of_typ thy T ^
   990           else error ("Type " ^ Syntax.string_of_typ_global thy T ^
   991             " to be substituted for variable " ^
   991             " to be substituted for variable " ^
   992             Sign.string_of_typ thy (TFree p) ^ "\ndoes not have sort " ^
   992             Syntax.string_of_typ_global thy (TFree p) ^ "\ndoes not have sort " ^
   993             Sign.string_of_sort thy S)
   993             Syntax.string_of_sort_global thy S)
   994         end))
   994         end))
   995       (Logic.list_implies (assms, subst_bounds (frees, strip gi))));
   995       (Logic.list_implies (assms, subst_bounds (frees, strip gi))));
   996   in test_term thy quiet size iterations gi' end;
   996   in test_term thy quiet size iterations gi' end;
   997 
   997 
   998 fun pretty_counterex ctxt NONE = Pretty.str "No counterexamples found."
   998 fun pretty_counterex ctxt NONE = Pretty.str "No counterexamples found."