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
, optExtensions :: [Extension] -- ^ enabled language extensions
, optDumps :: [DumpLevel] -- ^ dump levels
, optDumpEnv :: Bool -- ^ dump compilation environment
, optDumpRaw :: Bool -- ^ dump data structure
}
-- | Default compiler options
......@@ -64,6 +65,7 @@ defaultOptions = Options
, optExtensions = []
, optDumps = []
, optDumpEnv = False
, optDumpRaw = False
}
data CymakeMode
......@@ -241,6 +243,9 @@ options =
, Option "" ["dump-env"]
(NoArg (\ opts -> opts { optDumpEnv = True }))
"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 :: [OptDescr (Options -> Options)]
......
......@@ -208,12 +208,14 @@ transModule opts env mdl = (env5, ilCaseComp, dumps)
(lifted , env3) = lift simplified env2
(il , env4) = ilTrans flat' lifted env3
(ilCaseComp, env5) = completeCase il env4
dumps = [ (DumpDesugared , env1, show $ CS.ppModule desugared )
, (DumpSimplified , env2, show $ CS.ppModule simplified)
, (DumpLifted , env3, show $ CS.ppModule lifted )
, (DumpTranslated , env4, show $ IL.ppModule il )
, (DumpCaseCompleted, env5, show $ IL.ppModule ilCaseComp)
dumps = [ (DumpDesugared , env1, presentCS desugared )
, (DumpSimplified , env2, presentCS simplified)
, (DumpLifted , env3, presentCS lifted )
, (DumpTranslated , env4, presentIL il )
, (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
......
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