packages feed

yabi-muno-0.1.0.1: src/Main.hs

module Main
    ( main
    ) where

import Control.Monad.State
import System.Environment
import Text.Parsec

import Yabi

runProgram :: String -> IO ()
runProgram s = case parse programParser "" s of
    Left e   -> fail (show e)
    Right is -> runStateT (runVM $ run is) initWorld >> return ()

main :: IO ()
main = getArgs >>= go where
    go []    = getContents >>= runProgram
    go (x:_) = readFile x >>= runProgram