ContentsIndex
Renamer
Contents
Substitutions
Occurrence
Pretty Printing
Escaping
Synopsis
newtype Label = Label {
fromLabel :: Int
}
newtype Head = Head {
fromHead :: Int
}
newtype Variable = Variable Int
intersectionLabel :: Label
resultLabel :: Label
reservedLabels :: Int
intersectionHead :: Head
resultHead :: Head
reservedIDs :: Int
type Renamer = Map Int String
emptyRenamer :: Renamer
data Term
= Var !Variable
| Lab !Label
| App !Head ![Term]
isPlain :: Term -> Bool
succHead :: Head -> Head
minTerm :: Term
data Loc
= LVar !Variable
| LLab !Label
data Clause = Clause !Loc !Term
data Rule = (:=>) ![Clause] !Clause
data Intersection = Intersection !Label !Label !Label
converseMap :: (Ord e, Ord k) => Map k e -> Map e k
rename :: [(Label, [Term])] -> [Rule] -> [Intersection] -> (Renamer, [(Label, [Term])], [Rule], [Intersection], Int)
prepend0 :: String -> String
realLabel :: Renamer -> Label -> String
realHead :: Renamer -> Head -> String
realVariable :: Renamer -> Variable -> String
renameLabel :: Renamer -> Label -> Maybe Label
renameLabel' :: Renamer -> String -> Maybe Label
renameHead :: Renamer -> Head -> Maybe Head
renameVariable :: Renamer -> Variable -> Maybe Variable
renameTerm :: Renamer -> Term -> Maybe Term
newtype Subst = Subst [(Variable, Term)]
idSubst :: Subst
mergeSubst :: Subst -> Subst -> Subst
mergeSubsts :: [Subst] -> Subst
applySubstTerm :: Subst -> Term -> Term
applySubst :: Subst -> Clause -> Clause
occursInRules :: Label -> [Rule] -> Bool
occursInRule :: Label -> Rule -> Bool
occursInClause :: Label -> Clause -> Bool
occursInLoc :: Label -> Loc -> Bool
occursInTerm :: Label -> Term -> Bool
occursInIntersections :: Label -> [Intersection] -> Bool
occursInIntersection :: Label -> Intersection -> Bool
pprTerm :: Renamer -> Term -> String
pprTerms :: Renamer -> [Term] -> String
pprSaveTerm :: Renamer -> Term -> String
pprSaveTerms :: Renamer -> [Term] -> String
escapeName :: String -> String
escapeLabel :: Renamer -> Label -> Label
escapeTerm :: Renamer -> Term -> Term
Documentation
newtype Label
Constructors
Label
fromLabel :: Int
Instances
Eq Label
Ord Label
Show Label
newtype Head
Constructors
Head
fromHead :: Int
Instances
Eq Head
Ord Head
Show Head
newtype Variable
Constructors
Variable Int
Instances
Eq Variable
Ord Variable
Show Variable
intersectionLabel :: Label
resultLabel :: Label
reservedLabels :: Int
intersectionHead :: Head
resultHead :: Head
reservedIDs :: Int
type Renamer = Map Int String
emptyRenamer :: Renamer
data Term
Constructors
Var !Variable
Lab !Label
App !Head ![Term]
Instances
Show Term
Ord Term
Eq Term
isPlain :: Term -> Bool
succHead :: Head -> Head
minTerm :: Term
data Loc
Locations.
Constructors
LVar !Variable
LLab !Label
Instances
Eq Loc
Show Loc
Ord Loc
data Clause
A Clause is meant to be a pattern for matching Terms beloging to a Grammar.
Constructors
Clause !Loc !Term
data Rule
The Rules define the Term rewriting system. The implied meaning is "whenever the left hand side has a match in the Grammar, add the right hand side to the Grammar".
Constructors
(:=>) ![Clause] !Clause
data Intersection
A special IntersectionRule, defining a Label set as the intersection of two sets. This could be modeled by a set of Rules, once for each term head. See also intersect.
Constructors
Intersection !Label !Label !Label
converseMap :: (Ord e, Ord k) => Map k e -> Map e k
Utility.
rename :: [(Label, [Term])] -> [Rule] -> [Intersection] -> (Renamer, [(Label, [Term])], [Rule], [Intersection], Int)
The main routine.
prepend0 :: String -> String
Ugly hack to inject Int ordering into a String.
realLabel :: Renamer -> Label -> String
The true user-readable name of a Label.
realHead :: Renamer -> Head -> String
The true user-readable name of a Head.
realVariable :: Renamer -> Variable -> String
The true user-readable name of a Variable.
renameLabel :: Renamer -> Label -> Maybe Label
Slow renaming of Label.
renameLabel' :: Renamer -> String -> Maybe Label
Variant of renameLabel.
renameHead :: Renamer -> Head -> Maybe Head
Slow renaming of Head.
renameVariable :: Renamer -> Variable -> Maybe Variable
Slow renaming of Variable.
renameTerm :: Renamer -> Term -> Maybe Term
Slow renaming of Term.
Substitutions
newtype Subst
Constructors
Subst [(Variable, Term)]
Instances
Show Subst
idSubst :: Subst
The identity substitution.
mergeSubst :: Subst -> Subst -> Subst
Glues two disjoint substitutions together.
mergeSubsts :: [Subst] -> Subst
Glues many disjoint substitutions together.
applySubstTerm :: Subst -> Term -> Term
applySubst :: Subst -> Clause -> Clause
Apply Subst to a Clause. The Location in the result must be a Label.
Occurrence
occursInRules :: Label -> [Rule] -> Bool
occursInRule :: Label -> Rule -> Bool
occursInClause :: Label -> Clause -> Bool
occursInLoc :: Label -> Loc -> Bool
occursInTerm :: Label -> Term -> Bool
occursInIntersections :: Label -> [Intersection] -> Bool
occursInIntersection :: Label -> Intersection -> Bool
Pretty Printing
pprTerm :: Renamer -> Term -> String
Pretty print a Term.
pprTerms :: Renamer -> [Term] -> String
pprSaveTerm :: Renamer -> Term -> String
Pretty print a term in a format suitable for saving in a .rules file.
pprSaveTerms :: Renamer -> [Term] -> String
Escaping
escapeName :: String -> String

Prepend '@' to names staring with '$' or '%', in order to transform names for internal use only into user available user names.

NOTE
The computed closure is affected by label renaming: see addPlainTermSomewhere for details. escapeName should try to rename "better" labels into smaller (<) ones.

We try to keep '%' names small, by prefixing them with @a_. Similarly, we prefix '$' names with @z_.

escapeLabel :: Renamer -> Label -> Label
escapeTerm :: Renamer -> Term -> Term
Produced by Haddock version 0.6