Commit 1d8854ef authored by Björn Peemöller 's avatar Björn Peemöller
Browse files

Added option --dump-raw for dumping AST

parent fa15f499
...@@ -45,6 +45,7 @@ data Options = Options ...@@ -45,6 +45,7 @@ data Options = Options
, optExtensions :: [Extension] -- ^ enabled language extensions , optExtensions :: [Extension] -- ^ enabled language extensions
, optDumps :: [DumpLevel] -- ^ dump levels , optDumps :: [DumpLevel] -- ^ dump levels
, optDumpEnv :: Bool -- ^ dump compilation environment , optDumpEnv :: Bool -- ^ dump compilation environment
, optDumpRaw :: Bool -- ^ dump data structure
} }
-- | Default compiler options -- | Default compiler options
...@@ -64,6 +65,7 @@ defaultOptions = Options ...@@ -64,6 +65,7 @@ defaultOptions = Options
, optExtensions = [] , optExtensions = []
, optDumps = [] , optDumps = []
, optDumpEnv = False , optDumpEnv = False
, optDumpRaw = False
} }
data CymakeMode data CymakeMode
...@@ -241,6 +243,9 @@ options = ...@@ -241,6 +243,9 @@ options =
, Option "" ["dump-env"] , Option "" ["dump-env"]
(NoArg (\ opts -> opts { optDumpEnv = True })) (NoArg (\ opts -> opts { optDumpEnv = True }))
"additionally dump compilation environment for each dump level" "additionally dump compilation environment for each dump level"
, Option "" ["dump-raw"]
(NoArg (\ opts -> opts { optDumpRaw = True }))
"Dump as data structure instead of pretty printing"
] ++ dumpDescriptions ] ++ dumpDescriptions
dumpDescriptions :: [OptDescr (Options -> Options)] dumpDescriptions :: [OptDescr (Options -> Options)]
......
...@@ -208,12 +208,14 @@ transModule opts env mdl = (env5, ilCaseComp, dumps) ...@@ -208,12 +208,14 @@ transModule opts env mdl = (env5, ilCaseComp, dumps)
(lifted , env3) = lift simplified env2 (lifted , env3) = lift simplified env2
(il , env4) = ilTrans flat' lifted env3 (il , env4) = ilTrans flat' lifted env3
(ilCaseComp, env5) = completeCase il env4 (ilCaseComp, env5) = completeCase il env4
dumps = [ (DumpDesugared , env1, show $ CS.ppModule desugared ) dumps = [ (DumpDesugared , env1, presentCS desugared )
, (DumpSimplified , env2, show $ CS.ppModule simplified) , (DumpSimplified , env2, presentCS simplified)
, (DumpLifted , env3, show $ CS.ppModule lifted ) , (DumpLifted , env3, presentCS lifted )
, (DumpTranslated , env4, show $ IL.ppModule il ) , (DumpTranslated , env4, presentIL il )
, (DumpCaseCompleted, env5, show $ IL.ppModule ilCaseComp) , (DumpCaseCompleted, env5, presentIL ilCaseComp)
] ]
presentCS = if optDumpRaw opts then show else show . CS.ppModule
presentIL = if optDumpRaw opts then show else show . IL.ppModule
-- --------------------------------------------------------------------------- -- ---------------------------------------------------------------------------
-- Writing output -- Writing output
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment