2020-04-30 14:39:51 +04:00
|
|
|
|
2020-04-30 21:46:37 +04:00
|
|
|
import Data.Foldable (for_)
|
|
|
|
|
2020-05-08 00:09:14 +04:00
|
|
|
import Control.Monad (unless)
|
|
|
|
|
2020-04-30 14:39:51 +04:00
|
|
|
import ParseTree
|
|
|
|
import Parser
|
|
|
|
import AST
|
2020-05-01 19:04:29 +04:00
|
|
|
import Pretty
|
2020-04-30 14:39:51 +04:00
|
|
|
|
|
|
|
import System.Environment
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = do
|
|
|
|
[fin] <- getArgs
|
|
|
|
toParseTree fin >>= print
|
2020-04-30 21:46:37 +04:00
|
|
|
(res, errs) <- runParser contract fin
|
2020-05-08 00:09:14 +04:00
|
|
|
putStrLn "----------------------"
|
2020-04-30 21:46:37 +04:00
|
|
|
print (pp res)
|
2020-05-08 00:09:14 +04:00
|
|
|
unless (null errs) do
|
|
|
|
putStrLn ""
|
|
|
|
putStrLn "Errors:"
|
|
|
|
for_ errs (print . nest 2 . pp)
|