diff --git a/Justfile b/Justfile index 01c262e..a7acacd 100644 --- a/Justfile +++ b/Justfile @@ -26,4 +26,10 @@ hmd FILE: cabal run language -- -d -t hm {{FILE}} bid FILE: - cabal run language -- -d -t bi {{FILE}} \ No newline at end of file + cabal run language -- -d -t bi {{FILE}} + +hmdm FILE: + cabal run language -- -d -t hm -m {{FILE}} + +bidm FILE: + cabal run language -- -d -t bi -m {{FILE}} \ No newline at end of file diff --git a/src/Main.hs b/src/Main.hs index 5e4d09c..316024d 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -65,6 +65,7 @@ flags :: [OptDescr (Options -> Options)] flags = [ Option ['d'] ["debug"] (NoArg enableDebug) "Print debug messages." , Option ['t'] ["type-checker"] (ReqArg chooseTypechecker "bi/hm") "Choose type checker. Possible options are bi and hm" + , Option ['m'] ["disable-gc"] (NoArg disableGC) "Disables the garbage collector and uses malloc instead." , Option [] ["help"] (NoArg enableHelp) "Print this help message" ] @@ -73,6 +74,7 @@ initOpts = Options { help = False , debug = False + , gc = True , typechecker = Nothing } @@ -82,6 +84,9 @@ enableHelp opts = opts{help = True} enableDebug :: Options -> Options enableDebug opts = opts{debug = True} +disableGC :: Options -> Options +disableGC opts = opts{gc = False} + chooseTypechecker :: String -> Options -> Options chooseTypechecker s options = options{typechecker = tc} where @@ -93,6 +98,7 @@ chooseTypechecker s options = options{typechecker = tc} data Options = Options { help :: Bool , debug :: Bool + , gc :: Bool , typechecker :: Maybe TypeChecker }