X-Git-Url: https://ruin.nu/git/?p=proglang.git;a=blobdiff_plain;f=CompInt.hs;h=1934447c5e1110079dc94f93cf2867a9cfb52c47;hp=d5aa2ca052ada77068d47afd86bb901eeb053a98;hb=cdcd3b92ee3145e646634d428b02118238d47f33;hpb=04f0a9566794cf761b7bcf83190051a400ec3653 diff --git a/CompInt.hs b/CompInt.hs index d5aa2ca..1934447 100644 --- a/CompInt.hs +++ b/CompInt.hs @@ -48,6 +48,10 @@ main = do args <- getArgs case args of [] -> hGetContents stdin >>= run interpret pProgram - "-c":f:[] -> runFile (\fun st -> writeFile (f++".c") $ compile fun st) pProgram f + "-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 - _ -> print "Too many arguments" + _ -> do + putStrLn "Usage: ./CompInt [-c] " + putStrLn "-c : compile to C99-compatible file"