Reduction
[hcoop/domtool2.git] / src / main.sml
index 8cf8e67..7f7d2c0 100644 (file)
@@ -20,7 +20,7 @@
 
 structure Main :> MAIN = struct
 
-open Ast
+open Ast Print
 
 val dmy = ErrorMsg.dummyLoc
 
@@ -37,9 +37,22 @@ fun check fname =
            ()
        else
            let
-               val G' = Tycheck.checkFile Tycheck.empty tInit prog
+               val G' = Tycheck.checkFile Env.empty tInit prog
            in
-               ()
+               if !ErrorMsg.anyErrors then
+                   ()
+               else
+                   case prog of
+                       (_, SOME body) =>
+                       let
+                           val body' = Reduce.reduceExp G' body
+                       in
+                           printd (PD.hovBox (PD.PPS.Rel 0,
+                                              [PD.string "Result:",
+                                               PD.space 1,
+                                               p_exp body']))
+                       end
+                     | _ => ()
            end
     end