- [] -> hGetContents stdin >>= run interpret pStms
- "-c":f:[] -> runFile (writeFile (f++".c") . compile) pStms f
- f:[] -> runFile interpret pStms f
- _ -> print "Too many arguments"
+ [] -> hGetContents stdin >>= run interpret pProgram
+ "-c":f:[] -> let file = (f++".c") in do
+ putStrLn $ "Compiling "++f++" to the C99-compatible file:"++file
+ runFile (\fun st -> writeFile file $ compile fun st) pProgram f
+ f:[] -> runFile interpret pProgram f
+ _ -> do
+ putStrLn "Usage: ./CompInt [-c] <file>"
+ putStrLn "-c : compile <file> to C99-compatible file"