UMinho Haskell Libraries (1.0)ContentsIndex
Language.Sdf.Metrics.Size
Portability portable
Stability experimental
Maintainer Tiago Alves and Joost Visser
Contents
Representation
Function to calculate all metrics
Individual metric calculation functions
Auxiliary functions
Description
Metrics regarding the size of Sdf grammars.
Synopsis
data SizeMetrics = SizeMetrics {
term :: Float
var :: Float
uvar :: Float
prod :: Float
mcc :: Float
avsN :: Float
avsP :: Float
}
sizeMetrics :: SizeMetrics -> GroupMetric
calcSizeMetrics :: SDF -> SizeMetrics
calcTERM :: [Production] -> Float
calcVAR :: [Production] -> Float
calcUVar :: [Production] -> Float
calcMCC :: [Production] -> Float
calcMCC1 :: [Production] -> Float
calcMCC2 :: [Production] -> Float
calcAvsN :: Float -> Float -> Float
calcAvsP :: Float -> Float -> Float
calcSize :: [Production] -> Float
collectLiterals :: Term a => a -> [Literal]
getRHSsymbols :: Production -> [Symbol]
Representation
data SizeMetrics
Data type to hold all metric results
Constructors
SizeMetrics
term :: FloatNumber of unique used non-terminals.
var :: FloatNumber of defined terminals.
uvar :: FloatNumber of used terminals.
prod :: FloatNumber of context-free productions
mcc :: FloatMcCabe cyclomatic complexity. Measures the number of linearly independent paths through a flow graph.
avsN :: FloatAverage RHS per non-terminal. Calculated by the quotient of size and var.
avsP :: FloatAverage RHS per production. Calculated by the quotient of size and prod.
sizeMetrics :: SizeMetrics -> GroupMetric
Creates a uniform representation of the metrics converting the internal SizeMetrics record to a GroupMetric type which holds not only all the calculated metric values but also all information about the metrics: description and name.
Function to calculate all metrics
calcSizeMetrics :: SDF -> SizeMetrics
Calculates all size metrics
Individual metric calculation functions
calcTERM :: [Production] -> Float
Calculates the number of unique of terminals used in a list of productions.
calcVAR :: [Production] -> Float
Calculates the number of defined non-terminals in a list of productions
calcUVar :: [Production] -> Float
Calculates the number of unique used non-terminals in a list of production. This number can differ from calcVAR because a regular expression in a grammar is used as a non-terminal but is not defined in contex-free syntax.
calcMCC :: [Production] -> Float
Function that calculates the McCabe cyclomatic complexity
calcMCC1 :: [Production] -> Float
calcMCC2 :: [Production] -> Float
calcAvsN :: Float -> Float -> Float
Calculates the Average RHS size per defined non-terminal. This value is computed by dividing the total sum of the RHS (of all rules) by the number of non-terminals.
calcAvsP :: Float -> Float -> Float
Calculates the Average RHS size per production. This value is computed by dividing the total sum of the RHS size (of all rules) by the number of productions.
calcSize :: [Production] -> Float
Calculates the total RHS size of a grammar
Auxiliary functions
collectLiterals :: Term a => a -> [Literal]
Function that collect all literals of a term.
getRHSsymbols :: Production -> [Symbol]
Function that returns the RHS symbols of a production. This function is a little more general that getSyms (SdfLib module) because it also returns the literal from Sdf_prod_fun. It seems that some rules are recognized as Sdf_prod_fun.
Produced by Haddock version 0.6