Website Summary Files Commits Branches @commit @diff @stats
path: root / homework / 81248 / brainfsck / app / Main.hs
blob: de56a4fd122aa349e79f078dab13dc2261104f6e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
module Main 
    ( main
    ) where

import qualified Data.ByteString as BS

import           System.Environment

import           Brainfsck.Eval  (eval)
import           Brainfsck.Parse (parse)

main :: IO ()
main = do
    xs <- getArgs
    if length xs /= 1
    then putStrLn usage
    else either fail eval . parse =<< BS.readFile (head xs)

usage :: String
usage = "Usage: Start brainfsck with one argument - the path to a brainfuck script.\n\
         \> stack run brainfsck -- asdf.bf"