about summary refs log tree commit diff
path: root/app/Main.hs
blob: efe495b04ed41604ea17c3ca4e2dc95d30e12bb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Main where

import Syntax
import Typecheck
import Eval
import Control.Monad.Except

main :: IO ()
main = do
  input <-getContents
  let program = (read input)::Program 
  case runExcept $ wfProgram program of
    Left s -> print s
    Right () ->
      let (ret,state) = runProgram program in
        case ret of
          Left err-> print$ "Program finished with error" ++show err ++ "in state " ++ show state
          Right _ -> print$  "Program finished by going to the end to state" ++ show state