module ABS.Compiler.CmdOpt where
import System.Console.CmdArgs
import System.IO.Unsafe (unsafePerformIO)
cmdOpt :: CmdOpt
cmdOpt = unsafePerformIO (cmdArgs cmdOptSpec)
data CmdOpt = CmdOpt {
abs_sources :: [FilePath]
, output_dir :: FilePath
, create_script :: Bool
, dump_ast :: Bool
, nostdlib :: Bool
} deriving (Show, Data, Typeable)
cmdOptSpec :: CmdOpt
cmdOptSpec = CmdOpt {
abs_sources = def &= args &= typ "FILES/DIRS"
, output_dir = "gen/haskell" &= typDir &= help "In which directory to put all the Haskell translated files (.hs files)"
, create_script = def &= help "If given, creates a helper bash script for easier invoking the ghc Haskell compiler."
, dump_ast = def &= help "A flag to dump the parsed AST to stderr"
, nostdlib = def &= help "Will not include by-default the ABS.StdLib module. You have to do it manually with an import declaration."
}
&= program "habs"
&= help "A transcompiler from the ABS language to Haskell. Expects as input the ABS module files (ending in .abs) or whole directories containing ABS code."
&= helpArg [explicit, name "h", name "help"]
&= summary ("The ABS-Haskell compiler, Nikolaos Bezirgiannis, Envisage Project")