]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/lambda-delta/toplevel/top.ml
first version of kernel "basic_rg"
[helm.git] / helm / software / lambda-delta / toplevel / top.ml
index 27f40026e543dc3db1d83fcf3a1b327ea2d57816..92840d54a2df1d1b4ac8739376788b99f7f90975 100644 (file)
@@ -9,11 +9,14 @@
      \ /   This software is distributed as is, NO WARRANTY.              
       V_______________________________________________________________ *)
 
+module P    = Printf
+module L    = Log
 module AO   = AutOutput
 module MA   = MetaAut
 module MO   = MetaOutput
 module MBrg = MetaBrg
 module BrgO = BrgOutput
+module BrgU = BrgUntrusted
 
 type status = {
    summary: int;
@@ -37,10 +40,11 @@ let count st count_fun c item =
 let main =
    let version_string = "Helena Checker 0.8.0 M - December 2008" in
    let summary = ref 0 in
-   let stage = ref 2 in
+   let stage = ref 3 in
    let meta_file = ref None in
+   let hierarchy = ref (fun h -> h + 2) in
    let set_summary i = summary := i in
-   let print_version () = print_endline version_string; exit 0 in
+   let print_version () = L.warn version_string; exit 0 in
    let set_stage i = stage := i in
    let close = function
       | None          -> ()
@@ -56,7 +60,7 @@ let main =
    let read_file name =
       if !summary > 0 then Time.gmtime version_string;      
       if !summary > 1 then
-         Printf.printf "Processing file: %s\n" name; flush stdout;
+         L.warn (P.sprintf "Processing file: %s" name);
       if !summary > 0 then Time.utime_stamp "started";
       let ich = open_in name in
       let lexbuf = Lexing.from_channel ich in
@@ -66,10 +70,18 @@ let main =
       let rec aux st = function
          | []         -> st
         | item :: tl ->
-            let st = {st with ac = count st AO.count_item st.ac item} in
+(* stage 3 *)
+           let f st = function
+              | None                   -> st
+              | Some (_, (i, _, _, _)) ->
+                 Log.warn (string_of_int i); st
+           in
+(* stage 2 *)      
            let f st item =
-              {st with brgc = count st BrgO.count_item st.brgc item}
+              let st = {st with brgc = count st BrgO.count_item st.brgc item} in
+              if !stage > 2 then BrgU.type_check (f st) !hierarchy item else st
            in
+(* stage 1 *)      
            let f mst item = 
               let st = {st with
                  mst = mst; mc = count st MO.count_item st.mc item
@@ -80,6 +92,8 @@ let main =
               end;
               if !stage > 1 then MBrg.brg_of_meta (f st) item else st 
            in  
+(* stage 0 *)      
+            let st = {st with ac = count st AO.count_item st.ac item} in
            let st =
               if !stage > 0 then MA.meta_of_aut f st.mst item else st
            in