1 -- automatically generated by BNF Converter
5 import IO ( stdin, hGetContents )
6 import System ( getArgs, getProgName )
17 import Data.Map as Map hiding (showTree)
21 type ParseFun a = [Token] -> Err a
25 putStrV :: Int -> String -> IO ()
26 putStrV v s = if v > 1 then putStrLn s else return ()
28 runFile :: ([Stm] -> IO()) -> ParseFun Stms -> FilePath -> IO ()
29 runFile e p f = readFile f >>= run e p
31 run :: ([Stm] -> IO()) -> ParseFun Stms -> String -> IO ()
32 run e p s = let ts = myLLexer s in case p ts of
34 putStrLn "\nParse Failed...\n"
46 [] -> hGetContents stdin >>= run interpret pStms
47 "-c":f:[] -> let file = (f++".c") in do
48 putStrLn $ "Compiling "++f++" to the C99-compatible file:"++file
49 runFile (writeFile file . compile) pStms f
50 f:[] -> runFile interpret pStms f
52 putStrLn "Usage: ./CompInt [-c] <file>"
53 putStrLn "-c : compile <file> to C99-compatible file"