X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Finterface%2Freduction.ml;fp=helm%2Finterface%2Freduction.ml;h=0000000000000000000000000000000000000000;hb=fa11ed6dc134f8ad3421c37a97271018e075bbed;hp=8acb8eb94ddd53cf5ae3e13400ab5f807e112c84;hpb=c03d2c1fdab8d228cb88aaba5ca0f556318bebc5;p=helm.git diff --git a/helm/interface/reduction.ml b/helm/interface/reduction.ml deleted file mode 100644 index 8acb8eb94..000000000 --- a/helm/interface/reduction.ml +++ /dev/null @@ -1,70 +0,0 @@ -let read_from_stdin = ref false;; -let uris_in_input = ref false;; -let reduction_only = ref false;; - -let parse uri = - print_endline ("^^^" ^ uri ^ "^^^") ; - print_string (CicPp.ppobj (CicCache.get_obj (UriManager.uri_of_string uri))) ; - print_endline ("\n$$$" ^ uri ^ "$$$\n") -;; - -let uri_of_filename fn = - if !uris_in_input then fn - else - let uri = - Str.replace_first (Str.regexp (Str.quote Configuration.helm_dir)) "cic:" fn - in - let uri' = Str.replace_first (Str.regexp "\.xml$") "" uri in - uri' -;; - -(* filenames are read from command line and converted to uris via *) -(* uri_of_filenames; then the cic terms are load in cache via *) -(* CicCache.get_obj and then pretty printed via CicPp.ppobj *) - -exception NotADefinition;; - -let main () = - let files = ref [] in - Arg.parse - ["-stdin", Arg.Set read_from_stdin, "Read from stdin" ; - "-uris", Arg.Set uris_in_input, "Read uris, not filenames" ; - "-update", Arg.Unit Getter.update, "Update the getter view of the world" ; - "-reduction", Arg.Set reduction_only, "Do reduction instead of tyepchecking"] - (fun x -> files := (uri_of_filename x) :: !files) - " -usage: experiment file ... - -List of options:"; - if !read_from_stdin then - begin - try - while true do - let l = Str.split (Str.regexp " ") (read_line ()) in - List.iter (fun x -> files := (uri_of_filename x) :: !files) l - done - with - End_of_file -> () - end ; - files := List.rev !files; - List.iter - (function x -> - print_string x ; - flush stdout ; - (try - if !reduction_only then - match CicCache.get_obj (UriManager.uri_of_string x) with - Cic.Definition (_,bo,_,_) -> - CicTypeChecker.typecheck (UriManager.uri_of_string x) ; - ignore (CicReduction.whd bo) - | _ -> raise NotADefinition - else - CicTypeChecker.typecheck (UriManager.uri_of_string x) - with - e -> print_newline () ; flush stdout ; raise e ) ; - print_endline " OK!" ; - flush stdout - ) !files -;; - -main ();;