X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=Translator.hs;fp=Translator.hs;h=85f790a6a979baac92c54a632f4798c86f2a8dfb;hb=78b45072fc36c7311bee97f2d9195bbc33b994cf;hp=ad36bbcb950a28f292b7dfb9fde20f87013d7712;hpb=8782caddd5cc4df0c68e4025266c9b558e32eb48;p=matthijs%2Fmaster-project%2Fc%CE%BBash.git diff --git a/Translator.hs b/Translator.hs index ad36bbc..85f790a 100644 --- a/Translator.hs +++ b/Translator.hs @@ -26,7 +26,7 @@ import NameEnv ( lookupNameEnv ) import qualified HscTypes import HscTypes ( cm_binds, cm_types ) import MonadUtils ( liftIO ) -import Outputable ( showSDoc, ppr ) +import Outputable ( showSDoc, ppr, showSDocDebug ) import GHC.Paths ( libdir ) import DynFlags ( defaultDynFlags ) import qualified UniqSupply @@ -65,6 +65,24 @@ makeVHDL filename name stateful = do mapM (writeVHDL dir) vhdl return () +listBindings :: String -> IO [()] +listBindings filename = do + core <- loadModule filename + let binds = CoreSyn.flattenBinds $ cm_binds core + mapM (listBinding) binds + +listBinding :: (CoreBndr, CoreExpr) -> IO () +listBinding (b, e) = do + putStr "\nBinder: " + putStr $ show b + putStr "\nExpression: \n" + putStr $ prettyShow e + putStr "\n\n" + putStr $ showSDoc $ ppr e + putStr "\n\n" + putStr $ showSDoc $ ppr $ CoreUtils.exprType e + putStr "\n\n" + -- | Show the core structure of the given binds in the given file. listBind :: String -> String -> IO () listBind filename name = do