Commit 6247ec63 authored by Michael Hanus 's avatar Michael Hanus

Adds residuation analysis to CASS

parent d1ebee54
Residuation analysis
--------------------
This analysis checks whether a function does not residuate and yields,
if it successfully evaluates to some value,
a ground value provided that the function is called with some
ground values as arguments.
To bemore precise, the analysis associates to each function
one of the following results:
* `NoResiduateIf xs` (does not residuate if arguments `xs` are ground):
If the operation is called where the arguments in the index list `xs`
are ground values (where arguments are numbered from 1),
then the evaluation does not residuate and yields a ground value.
For instance, the operation
const :: a -> b -> a
const x _ = x
has the residuation behavior `NoResiduateIf [1]`, and the
list concatenation `++` has the residuation behavior `NoResiduateIf [1,2]`.
* `MayResiduate` (possible residuation or non-ground result):
The operation might residuate or yields a non-ground value,
independent of the arguments. For instance, this is the case
for the operations
f x = x + ensureNotFree unknown
g x = (x,y) where y free
* `NoResInfo` (unknown residuation behavior):
The residuation behavior of this function cannot be determined.
This might occur when complex recursive `let`s are involved.
-- Tests for the RootReplaced analysis
-- Tests for the non-determinism dependency analysis `NonDetDeps`.
--
-- Runt test with:
-- > cass NonDetDeps NonDetTest.curry
......
--- A simple program to show the usage of the API mode of CASS
--- to access the demanded values of the operation Rev.rev:
import CASS.Server (analyzeGeneric)
import Analysis.ProgInfo (lookupProgInfo)
import Analysis.Demandedness (demandAnalysis)
import CASS.Server ( analyzeGeneric )
import Analysis.ProgInfo ( lookupProgInfo )
import Analysis.Demandedness ( demandAnalysis )
demandedArgumentsOf :: String -> String -> IO [Int]
demandedArgumentsOf modname fname = do
......
......@@ -6,7 +6,7 @@
--- the analysis server (which is implicitly started if necessary).
---
--- @author Michael Hanus
--- @version January 2017
--- @version September 2018
--------------------------------------------------------------------------
module CASS.Configuration
......@@ -34,7 +34,7 @@ import CASS.PackageConfig (packagePath, packageExecutable, packageVersion)
systemBanner :: String
systemBanner =
let bannerText = "CASS: Curry Analysis Server System (Version " ++
packageVersion ++ " of 05/06/2018 for " ++
packageVersion ++ " of 10/09/2018 for " ++
curryCompiler ++ ")"
bannerLine = take (length bannerText) (repeat '=')
in bannerLine ++ "\n" ++ bannerText ++ "\n" ++ bannerLine
......
......@@ -5,7 +5,7 @@
--- registered in the top part of this module.
---
--- @author Heiko Hoffmann, Michael Hanus
--- @version January 2017
--- @version September 2018
--------------------------------------------------------------------
module CASS.Registry
......@@ -40,6 +40,7 @@ import Analysis.Indeterministic
import Analysis.RequiredValue
import qualified Analysis.RequiredValues as RVS
import Analysis.RightLinearity
import Analysis.Residuation
import Analysis.RootReplaced
import Analysis.SensibleTypes
import Analysis.SolutionCompleteness
......@@ -76,6 +77,7 @@ registeredAnalysis =
,cassAnalysis "Sibling constructors" siblingCons showSibling
,cassAnalysis "Required value" reqValueAnalysis showAFType
,cassAnalysis "Required value sets" RVS.reqValueAnalysis RVS.showAFType
,cassAnalysis "Residuating operations" residuationAnalysis showResInfo
,cassAnalysis "Root cyclic replacements" rootCyclicAnalysis showRootCyclic
,cassAnalysis "Root replacements" rootReplAnalysis showRootRepl
,cassAnalysis "Terminating operations" terminationAnalysis showTermination
......
......@@ -132,6 +132,7 @@ analyzeModule ananame moduleName enforce aoutformat = do
--- The analysis must be a registered one if workers are used.
--- If it is a combined analysis, the base analysis must be also
--- a registered one.
--- Returns either the analysis information or an error message.
analyzeGeneric :: Analysis a -> String -> IO (Either (ProgInfo a) String)
analyzeGeneric analysis moduleName = do
initializeAnalysisSystem
......@@ -160,6 +161,7 @@ analyzeGeneric analysis moduleName = do
--- The analysis must be a registered one if workers are used.
--- If it is a combined analysis, the base analysis must be also
--- a registered one.
--- Returns either the analysis information or an error message.
analyzePublic :: Analysis a -> String -> IO (Either (ProgInfo a) String)
analyzePublic analysis moduleName =
analyzeGeneric analysis moduleName
......
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