args <- getArgs
case args of
[] -> hGetContents stdin >>= run interpret pStms
- "-c":f:[] -> runFile (writeFile (f++".c") . compile) pStms f
+ "-c":f:[] -> let file = (f++".c") in do
+ putStrLn $ "Compiling "++f++" to the C99-compatible file:"++file
+ runFile (writeFile file . compile) pStms f
f:[] -> runFile interpret pStms f
- _ -> print "Too many arguments"
+ _ -> do
+ putStrLn "Usage: ./CompInt [-c] <file>"
+ putStrLn "-c : compile <file> to C99-compatible file"
Abssyntax.hs, Parsyntax.y, Lexsyntax.x,ErrM.hs,Printsyntax.hs,Skelsyntax.hs: The files generated by bnfc, only modification is the removal of the Bool type in Abssyntx.hs so haskell's internal type can be used.
-typing rules
+semantic rules
++++++++++++