shivers-cfg-0.1.1: Implementation of Shivers' Control-Flow Analysis

Safe HaskellNone
LanguageHaskell98

CPSPrint

Contents

Description

A Pretty printer for CPSScheme-files and control flow.

Synopsis

Pretty printer for CPSScheme programs, omitting any labels

ppProg :: Bool -> Prog -> Doc Source

Pretty-Prints a whole document. The first flag, if set to true, embedds the label information by abusing high range unicode characters.

renderProg :: Bool -> Prog -> String Source

Renders to a String

Label embedding trick

startAt :: Integer Source

First unicode point to embed labels with (Private Use Area)

labelPositions :: Char -> String -> (Label :⇀ (Integer, Integer), String) Source

Given a replacement function and a string containing embedded labels, this function replaces the labels by the given replacement character and calculates a map of labels to positions in the text (1-based row and column indexing)

removeLambdas :: String -> String Source

HPDF can not print lambdas. Therefore, replace them by backslashes.

Printing to Isablle-Expression

ipProg :: Prog -> Doc Source

Converts the whole program into an expression that can be copynpasted into an Isabelle source file

renderProgToIsa :: Prog -> String Source

Renders to a String