cleanup options
build / build (push) Successful in 1m14s

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