LicenseGNU LGPLv3
Maintainerpaul.bittner@uni-ulm.de
Safe HaskellNone

FeatureTrace

Description

Data types and functions for feature traces and presence conditions.

Synopsis

Documentation

type FeatureTrace g a = Node g a -> FeatureFormula Source #

A feature trace (or feature mapping) assigns a nullable propositional formula over features to each node in an AST. (See Definition 3.1 in the paper).

emptyTrace :: FeatureTrace g a Source #

A feature trace with no information. It assigns null (Nothing) to each node. This feature trace serves as a possible starting point for feature trace recording (e.g., when no domain knowledge was documented in a software project).

simplifyFeatureTrace :: (Grammar g, Show a, Eq a) => FeatureTrace g a -> AST g a -> FeatureTrace g a Source #

Simplifies a feature trace over a given AST. A feature formula of a node can be simplified w.r.t. to the feature mappings of all its ancestors. For example, when the root of a tree is mapped to A, no descendant has to be mapped to A anymore as they inherit A in their presence condition (pc).

simplifyFeatureTraceOfNodes :: (Grammar g, Show a, Eq a) => FeatureTrace g a -> AST g a -> Set (Node g a) -> FeatureTrace g a Source #

Simplifies the feature mappings for all nodes in the given set from the given AST. The given set is assumed to be a subset of the nodes in the tree. For further information, see simplifyFeatureTrace.

pc :: (Grammar g, Show a, Eq a) => AST g a -> FeatureTrace g a -> Node g a -> FeatureFormula Source #

Calculates the presence condition of a node (third argument) in the given tree (first argument) with the given feature traces (second argument). See Equation 1 in the paper.

pc_parentpart :: (Grammar g, Show a, Eq a) => AST g a -> FeatureTrace g a -> Node g a -> FeatureFormula Source #

Calculates the parental part of the presence condition of a node (third argument) in the given tree (first argument) with the given feature traces (second argument). Crashes when the given node is not in the given tree. (This should be more helpful for debugging instead of just returning Nothing.)

prettyPrint :: (Grammar g, Show a) => FeatureTrace g a -> AST g a -> String Source #

Pretty print the AST and annotate all nodes with their feature mappings.