E-mail aliases
[hcoop/domtool2.git] / src / main.sml
index 7f7d2c0..bbf1091 100644 (file)
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-*)
+ *)
 
 (* Main interface *)
 
@@ -30,6 +30,20 @@ val tInit = (TAction ((CRoot, dmy),
             dmy)
            
 fun check fname =
+    let
+       val prog = Parse.parse fname
+    in
+       if !ErrorMsg.anyErrors then
+           ()
+       else
+           let
+               val G' = Tycheck.checkFile Env.empty tInit prog
+           in
+               ()
+           end
+    end
+
+fun reduce fname =
     let
        val prog = Parse.parse fname
     in
@@ -56,4 +70,31 @@ fun check fname =
            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) =>
+                       let
+                           val body' = Reduce.reduceExp G' body
+                       in
+                           if !ErrorMsg.anyErrors then
+                               ()
+                           else
+                               Eval.exec StringMap.empty body'
+                       end
+                     | _ => ()
+           end
+    end
+
 end