|
Language.Sdf.Metrics.Ambiguity | Portability | portable
| Stability | experimental
| Maintainer | Tiago Alves and Joost Visser
|
|
|
|
|
|
Description |
Metrics regarding the ambibuity constructs of Sdf.
|
|
Synopsis |
|
|
|
|
Defined data structures |
|
data AmbigMetrics |
Data type to hold all metric results | Constructors | AmbigMetrics | | frst :: Int | Number of follow restrictions | assoc :: Int | Number of associativity attributes in context-free productions | rejP :: Int | Number of reject productions | uppri :: Float | Number of unique productions in priorities | tnupeg :: Float | Total number of unique productions in each group | tnpc :: Float | Total number of priority chains | tng :: Float | Total 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 |