UMinho Haskell Libraries (1.0)ContentsIndex
Language.Sdf.Metrics.Ambiguity
Portability portable
Stability experimental
Maintainer Tiago Alves and Joost Visser
Contents
Defined data structures
Functions to calculate and print all metrics
Individual metric calculation functions
Auxiliary functions
Description
Metrics regarding the ambibuity constructs of Sdf.
Synopsis
data AmbigMetrics = AmbigMetrics {
frst :: Int
assoc :: Int
rejP :: Int
uppri :: Float
tnupeg :: Float
tnpc :: Float
tng :: Float
}
calcAmbigMetrics :: SDF -> AmbigMetrics
ambigMetrics :: AmbigMetrics -> GroupMetric
calcFollowRestr :: SDF -> Int
calcAssocAttr :: [Production] -> Int
calcRejectProds :: SDF -> Int
calcUPPri :: [Priority] -> Float
calcTNUPEG :: [Priority] -> Float
calcTNPC :: [Priority] -> Float
calcTNG :: [Priority] -> Float
collectPriorityProductions :: [Priority] -> [Production]
collectGroups :: [Priority] -> [Group]
nrUniqueElems :: Ord a => [a] -> Int
Defined data structures
data AmbigMetrics
Data type to hold all metric results
Constructors
AmbigMetrics
frst :: IntNumber of follow restrictions
assoc :: IntNumber of associativity attributes in context-free productions
rejP :: IntNumber of reject productions
uppri :: FloatNumber of unique productions in priorities
tnupeg :: FloatTotal number of unique productions in each group
tnpc :: FloatTotal number of priority chains
tng :: FloatTotal number of priority groups
Functions to calculate and print all metrics
calcAmbigMetrics :: SDF -> AmbigMetrics
Calculates all ambiguity-related metrics.
ambigMetrics :: AmbigMetrics -> GroupMetric
Creates a uniform representation of the metrics converting the internal AmbigMetrics record to a GroupMetric type which holds not only all the calculated metric values but also all information about the metrics: description and name.
Individual metric calculation functions
calcFollowRestr :: SDF -> Int
Calculate the number of follow restrictions
calcAssocAttr :: [Production] -> Int
Calculate the number of assoc attributes in context-free productions
calcRejectProds :: SDF -> Int
Calculate the number of reject productions
calcUPPri :: [Priority] -> Float
Calculate the number of unique productions in priorities NOTE: this function have a very peculiar behavior without (map show), because it creates a set with a single element. Doing (map show) the cardinality of the set have correct value.
calcTNUPEG :: [Priority] -> Float
Calculate total number of unique productions in each group
calcTNPC :: [Priority] -> Float
Calculate the total number of priority chains
calcTNG :: [Priority] -> Float
Calculate the total number of groups
Auxiliary functions
collectPriorityProductions :: [Priority] -> [Production]
Collect productions inside priorities.
collectGroups :: [Priority] -> [Group]
Collect groups inside priorities. A group can have a single or multiple productions
nrUniqueElems :: Ord a => [a] -> Int
Helper function to calculate the number of unique elements of a list
Produced by Haddock version 0.6