definition:
|
transformNondet :: Int -> Bool -> Bool -> String -> IO ()
transformNondet termdepth keepmax withwlist modname = do
(FC.Prog _ imports typedecls _ _, rules) <- readFlatCurryRules modname
let absdom = depthDom termdepth
maincalls = genMainCalls absdom rules
lessSpecificEq = lessSpecificEqResult lessDSpecific
printProgram absdom rules maincalls
let seminsertion = if keepmax then updateSemEq lessSpecificEq
else insertSemEq
fpsem <- if not withwlist
then runFixpoint absdom seminsertion rules maincalls False eqSemInt
else runFixpointWL absdom lessSpecificEq rules maincalls False
putStrLn (showSemInt absdom (sort fpsem))
let strinfos = sortFuncInfos (extractStrictness absdom fpsem)
putStrLn ('\n' : showStrictness strinfos)
createAnalysisDir modname
writeFile (strictInfoFileName modname) (show strinfos)
ndinfos <- getNondetInfos modname >>= return . sortFuncInfos
putStrLn ("Computed non-determinism information:\n"++show ndinfos++"\n")
writeFile (ndInfoFileName modname) (show ndinfos)
let (transrules,numopts) = transformRules ndinfos strinfos rules
newprog = letDropping $ unApply transrules
newprogtxt = showTRS newprog
putStrLn $ "Transformed program (stored in '"++modname++"_O.curry'):"
putStrLn newprogtxt
writeFile (modname++"_O.curry")
(unlines (map ("import "++) (filter (/="Prelude") imports)) ++
concatMap showDataDeclAsCurry typedecls ++ newprogtxt)
putStrLn $ "Number of performed optimizations: " ++ show numopts
where
showDataDeclAsCurry fd =
showCurryDataDecl (FC.showQNameInModule (dataModule fd)) fd
|