src/Tools/code/code_funcgr.ML
changeset 30240 5b25fee0362c
parent 28924 5c8781b7d6a4
child 30242 aea5d7fa7ef5
equal deleted inserted replaced
30239:179ff9cb160b 30240:5b25fee0362c
     1 (*  Title:      Tools/code/code_funcgr.ML
     1 (*  Title:      Tools/code/code_funcgr.ML
     2     ID:         $Id$
       
     3     Author:     Florian Haftmann, TU Muenchen
     2     Author:     Florian Haftmann, TU Muenchen
     4 
     3 
     5 Retrieving, normalizing and structuring defining equations in graph
     4 Retrieving, normalizing and structuring code equations in graph
     6 with explicit dependencies.
     5 with explicit dependencies.
       
     6 
       
     7 Legacy.  To be replaced by Tools/code/code_wellsorted.ML
     7 *)
     8 *)
     8 
     9 
     9 signature CODE_FUNCGR =
    10 signature CODE_WELLSORTED =
    10 sig
    11 sig
    11   type T
    12   type T
    12   val eqns: T -> string -> (thm * bool) list
    13   val eqns: T -> string -> (thm * bool) list
    13   val typ: T -> string -> (string * sort) list * typ
    14   val typ: T -> string -> (string * sort) list * typ
    14   val all: T -> string list
    15   val all: T -> string list
    20   val eval_term: theory
    21   val eval_term: theory
    21     -> (term -> term * (((sort -> sort) * Sorts.algebra) -> T -> 'a)) -> term -> 'a
    22     -> (term -> term * (((sort -> sort) * Sorts.algebra) -> T -> 'a)) -> term -> 'a
    22   val timing: bool ref
    23   val timing: bool ref
    23 end
    24 end
    24 
    25 
    25 structure Code_Funcgr : CODE_FUNCGR =
    26 structure Code_Wellsorted : CODE_WELLSORTED =
    26 struct
    27 struct
    27 
    28 
    28 (** the graph type **)
    29 (** the graph type **)
    29 
    30 
    30 type T = (((string * sort) list * typ) * (thm * bool) list) Graph.T;
    31 type T = (((string * sort) list * typ) * (thm * bool) list) Graph.T;
   316 fun code_deps_cmd thy = code_deps thy o op @ o Code_Name.read_const_exprs thy;
   317 fun code_deps_cmd thy = code_deps thy o op @ o Code_Name.read_const_exprs thy;
   317 
   318 
   318 in
   319 in
   319 
   320 
   320 val _ =
   321 val _ =
   321   OuterSyntax.improper_command "code_thms" "print system of defining equations for code" OuterKeyword.diag
   322   OuterSyntax.improper_command "code_thms" "print system of code equations for code" OuterKeyword.diag
   322     (Scan.repeat P.term_group
   323     (Scan.repeat P.term_group
   323       >> (fn cs => Toplevel.no_timing o Toplevel.unknown_theory
   324       >> (fn cs => Toplevel.no_timing o Toplevel.unknown_theory
   324         o Toplevel.keep ((fn thy => code_thms_cmd thy cs) o Toplevel.theory_of)));
   325         o Toplevel.keep ((fn thy => code_thms_cmd thy cs) o Toplevel.theory_of)));
   325 
   326 
   326 val _ =
   327 val _ =
   327   OuterSyntax.improper_command "code_deps" "visualize dependencies of defining equations for code" OuterKeyword.diag
   328   OuterSyntax.improper_command "code_deps" "visualize dependencies of code equations for code" OuterKeyword.diag
   328     (Scan.repeat P.term_group
   329     (Scan.repeat P.term_group
   329       >> (fn cs => Toplevel.no_timing o Toplevel.unknown_theory
   330       >> (fn cs => Toplevel.no_timing o Toplevel.unknown_theory
   330         o Toplevel.keep ((fn thy => code_deps_cmd thy cs) o Toplevel.theory_of)));
   331         o Toplevel.keep ((fn thy => code_deps_cmd thy cs) o Toplevel.theory_of)));
   331 
   332 
   332 end;
   333 end;