structure Main :> MAIN = struct
-open Ast
+open Ast Print
val dmy = ErrorMsg.dummyLoc
()
else
let
- val G' = Tycheck.checkFile Tycheck.empty tInit prog
+ val G' = Tycheck.checkFile Env.empty tInit prog
in
()
end
end
+fun reduce fname =
+ let
+ val prog = Parse.parse fname
+ in
+ if !ErrorMsg.anyErrors then
+ ()
+ else
+ let
+ 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
+
+fun eval fname =
+ let
+ val prog = Parse.parse fname
+ in
+ if !ErrorMsg.anyErrors then
+ ()
+ else
+ let
+ val G' = Tycheck.checkFile Env.empty tInit prog
+ in
+ if !ErrorMsg.anyErrors then
+ ()
+ else
+ case prog of
+ (_, SOME body) => Eval.exec StringMap.empty body
+ | _ => ()
+ end
+ end
+
end