Skip to content
Snippets Groups Projects
Commit c99f4348 authored by Kilyan Le Gallic's avatar Kilyan Le Gallic
Browse files

[wp] Verbose iteration of opened theories as a PoC of theory crawling

parent e771d7ec
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
(**************************************************************************) (**************************************************************************)
module L = Wp_parameters module L = Wp_parameters
module P = Why3.Pmodule
module T = Why3.Theory module T = Why3.Theory
module F = Filepath.Normalized module F = Filepath.Normalized
module W = Why3 module W = Why3
...@@ -44,15 +43,32 @@ let extract_last_segments (str_list : string list) = ...@@ -44,15 +43,32 @@ let extract_last_segments (str_list : string list) =
| [] -> ("", []) | [] -> ("", [])
) str_list ) str_list
let get_name_from_ident (ident) =
let ident_printer = W.Ident.create_ident_printer [] in
W.Ident.id_unique (ident_printer) ident
let open_theory (env) (theories) = let open_theory (env) (theories) =
List.iter List.iter
(fun (thy_n, thy_p) -> (fun (thy_n, thy_p) ->
try try
let theory = (W.Env.read_theory env (thy_p) (thy_n)) in let theory = (W.Env.read_theory env (thy_p) (thy_n)) in
W.Pretty.print_theory Format.std_formatter theory; List.iter ( fun (tdecl : T.tdecl) ->
match tdecl.td_node with
| Decl d ->
(match (d.d_node : W.Decl.decl_node) with
| Dtype dtype -> L.debug ~level:0 "Decl and type, named : %s.@" (get_name_from_ident dtype.ts_name);
| Ddata _ -> L.debug ~level:0 "Decl and ddata"
| Dparam _ -> L.debug ~level:0 "Decl and dparam"
| Dlogic _ -> L.debug ~level:0 "Decl and dlogic"
| _ -> L.debug ~level:0 "Decl but whatever")
| Use _ -> L.debug ~level:0 "Use"
| Clone _ -> L.debug ~level:0 "Clone"
| Meta _ -> L.debug ~level:0 "Meta"
) theory.th_decls;
with W.Env.LibraryNotFound paths -> with W.Env.LibraryNotFound paths ->
L.debug ~level:0 "Library %s not found at %s " thy_n (String.concat "." paths); L.debug ~level:0 "Library %s not found at %s " thy_n (String.concat "." paths);
) (extract_last_segments theories) ) (extract_last_segments theories)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment