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

Main

Description

Module of the main function to run demos and print meta-information.

Synopsis

Documentation

data CodePrintStyle Source #

Style defining how to print ASTs.

Constructors

ShowAST

Prints the AST by showing each Node in the hierarchy in an XML-like format.

ShowCode

Prints the AST as the actual source code that it represents.

ShowTikz

Print the AST as tikz code to use for our paper.

Instances

Instances details
Show CodePrintStyle Source # 
Instance details

Defined in Main

Methods

showsPrec :: Int -> CodePrintStyle -> ShowS

show :: CodePrintStyle -> String

showList :: [CodePrintStyle] -> ShowS

data TraceDisplay Source #

Format defining whether to FeatureTraces or presence conditions (pc).

Constructors

Trace

Show the feature mapping of each node (i.e., the formula a node is directly annotated with).

PC

Show the presence condition of each node (i.e., the conjunction of its feature mapping with all feature mappings inherited from ancestors).

Instances

Instances details
Eq TraceDisplay Source # 
Instance details

Defined in Main

Methods

(==) :: TraceDisplay -> TraceDisplay -> Bool

(/=) :: TraceDisplay -> TraceDisplay -> Bool

Show TraceDisplay Source # 
Instance details

Defined in Main

Methods

showsPrec :: Int -> TraceDisplay -> ShowS

show :: TraceDisplay -> String

showList :: [TraceDisplay] -> ShowS

data TraceStyle Source #

Style defining how to print FeatureTraces.

Constructors

Text

Show feature mapping formulas as plain text.

Colour

Encode features as colours to visualize feature mappings by colouring source code.

None

Do not show feature traces at all.

Instances

Instances details
Eq TraceStyle Source # 
Instance details

Defined in Main

Methods

(==) :: TraceStyle -> TraceStyle -> Bool

(/=) :: TraceStyle -> TraceStyle -> Bool

Show TraceStyle Source # 
Instance details

Defined in Main

Methods

showsPrec :: Int -> TraceStyle -> ShowS

show :: TraceStyle -> String

showList :: [TraceStyle] -> ShowS

data OutputFormat Source #

Format in which code and (recorded) feature mappings should be printed to the terminal.

Constructors

OutputFormat 

Fields

userFormat :: OutputFormat Source #

The perspective of the developer, who is editing code while traces are recorded in the background This is the format used in the figures in the paper.

userFormatDetailed :: OutputFormat Source #

A variation of userFormat where traces and presence conditions can be investigated seperately at the same time. Code is coloured in the colour of its trace while presence conditions are indicated by coloured lines on the left.

astFormat :: OutputFormat Source #

Shows the AST of the source code with FeatureTraces as formulas.

tikzFormat :: OutputFormat Source #

Tikz export of AST with FeatureTraces. Used for figures in the paper.

main :: IO () Source #

Entry point of the demo. The main method will run and print the output of all examples (Alice, Bob, and the edit patterns). You can change the format of the printed source code and feature mappings by changing the format parameter inside main. Additionally, you might want to look at the truthtable of the ternary logic by Sobocinski we use (by uncommenting the line showTruthtables).

showExamples :: OutputFormat -> IO () Source #

Runs the motivating example from the paper and examples for all edit patterns with the given OutputFormat. First, runs Alice's example where she records feature traces upon editing the pop method of a class Stack in Java (Figure 1 in the paper). Second, shows how Bob could propagate Alice's edits and recorded feature traces to his variant as envisioned in future research. Third, shows an instance of each edit pattern from our evaluation.

headline :: MonadColorPrinter m => String -> m () Source #

Turns the given text into a headline in the terminal. We indicate headlines with a red background.

runStepwise :: (MonadColorPrinter m, Grammar g, ASTPrettyPrinter g) => OutputFormat -> State UUID (Example m g String) -> m () Source #

Runs the given Example in the given OutputFormat step by step (i.e., showing all intermediate results).

printASTWithTrace :: (MonadColorPrinter m, Grammar g, ASTPrettyPrinter g, Show a, Eq a) => OutputFormat -> FeatureFormulaColourPalette m -> AST g a -> FeatureTrace g a -> Doc (Attribute m) Source #

Prints the given AST with the given FeatureTraces in the given OutputFormat. If the OutputFormat mandates to visualize feature mappings as colours (see TraceStyle), the given FeatureFormulaColourPalette will be used to assign colours to feature formulas.

printTraces :: (MonadColorPrinter m, Grammar g, ASTPrettyPrinter g, Show a, Eq a) => OutputFormat -> Example m g a -> [Version g a] -> Doc (Attribute m) Source #

Prints the given list of versions that were produced from the given example.

alsoShowInitialStateInHistory :: History g a -> History g a Source #

Helper function to show the initial state of the given history in printTraces. Prepends an identity edit and dummy FeatureContext. The context could be anything and thus is set to Nothing (null).

propositional_values :: [PropositionalFormula String] Source #

Helper function to help with type inference. Returns all atomic values of a PropositionalFormula (over strings).

nullableFormula_values :: [NullableFormula String] Source #

Helper function to help with type inference. Returns all atomic values of a NullableFormula (over strings).

showTruthtables :: IO () Source #

Prints truthtables for common operators in PropositionalFormulas and NullableFormulas (not, and, or, implies, equiv)