SSTG-0.1.0.4: app/Main.hs
module Main where
import SSTG
import System.Environment
main :: IO ()
main = do
-- Get command line arguments.
(proj:src:tail_args) <- getArgs
-- Make bindings.
binds <- mkTargetBindings proj src
-- Configure entry.
let entry = if length tail_args > 0 then tail_args !! 0 else "main"
-- Do the loading.
let load_result = loadStateEntry entry (Program binds)
putStrLn $ "binds: " ++ show (length binds)
-- putStrLn "Bindings"
-- mapM_ (putStrLn . pprBindingStr) binds
case load_result of
LoadError str -> do
error str
LoadOkay state -> do
putStrLn" **************** INIT ***************"
putStrLn "Initial state:"
putStrLn $ pprStateStr state
putStrLn "*************** BEGIN ***************"
let lds = execute1 40 state
putStrLn $ pprLivesDeadsStr lds
LoadGuess state cands -> do
putStrLn $ pprStateStr state
putStrLn "Other possible candidates:"
putStrLn $ show cands