diff --git a/src/Gyehoek/Options.hs b/src/Gyehoek/Options.hs index f09c750..3ce8956 100644 --- a/src/Gyehoek/Options.hs +++ b/src/Gyehoek/Options.hs @@ -13,14 +13,13 @@ import Data.Foldable import Gyehoek.Prelude hiding (argument) -data Runtime = Stackify | Wasm | CPS | HigherOrderCPS +data Runtime = Wasm | CPS | HigherOrderCPS deriving (Show, Generic, Eq) data Language = LanguageScheme | LanguageCPS | LanguageClosed - | LanguageStackified | LanguageWasm deriving (Show, Generic, Eq) @@ -28,31 +27,27 @@ data Options = MkOptions { dumpClosed :: Bool , dumpCPS :: Bool , dumpParsed :: Bool - , dumpStackified :: Bool , dumpHoisted :: Bool - , dumpContified :: Bool - , traceStackified :: Bool , noColour :: Bool , runtime :: Maybe Runtime , inspectWasm :: Bool , output :: FilePath , sourceFile :: FilePath , sourceLanguage :: Language + , targetLanguage :: Language } deriving (Show, Generic) -languageValues = ["scheme","cps","closed","stackified","wasm"] +languageValues = ["scheme","cps","closed","wasm"] languageReader = maybeReader \case "scheme" -> Just LanguageScheme "cps" -> Just LanguageCPS "closed" -> Just LanguageClosed - "stackified" -> Just LanguageStackified "wasm" -> Just LanguageWasm _ -> Nothing runtimeValues = ["stackify","wasm","cps","none"] runtimeReader = maybeReader \case - "stackify" -> Just (Just Stackify) "wasm" -> Just (Just Wasm) "cps1" -> Just (Just CPS) ("cps";"higher-order-cps") -> Just (Just HigherOrderCPS) @@ -63,11 +58,8 @@ parser :: Parser Options parser = do dumpClosed <- switch (long "dump-closed") dumpCPS <- switch (long "dump-cps") - dumpStackified <- switch (long "dump-stackified") dumpParsed <- switch (long "dump-parsed") dumpHoisted <- switch (long "dump-hoisted") - dumpContified <- switch (long "dump-contified") - traceStackified <- switch (long "trace-stackified") noColour <- switch . fold $ [ long "no-colour" , long "no-color" @@ -89,6 +81,14 @@ parser = do , showDefaultWith $ const "scheme" , metavar "LANGUAGE" ] + targetLanguage <- option languageReader . fold $ + [ long "target" + , short 'T' + , value LanguageCPS + , completeWith languageValues + , showDefaultWith $ const "cps" + , metavar "LANGUAGE" + ] output <- strOption . fold $ [ long "output" , short 'o'