|
|
|
|
|
|
Synopsis |
|
|
|
Documentation |
|
newtype Label |
|
|
newtype Head |
|
|
newtype Variable |
|
|
intersectionLabel :: Label |
|
resultLabel :: Label |
|
reservedLabels :: Int |
|
intersectionHead :: Head |
|
resultHead :: Head |
|
reservedIDs :: Int |
|
type Renamer = Map Int String |
|
emptyRenamer :: Renamer |
|
data Term |
|
|
isPlain :: Term -> Bool |
|
succHead :: Head -> Head |
|
minTerm :: Term |
|
data Loc |
Locations. | Constructors | | Instances | |
|
|
data Clause |
A Clause is meant to be a pattern for matching Terms beloging to
a Grammar. | Constructors | |
|
|
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 | |
|
|
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 | |
|
|
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 |
|
|
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 |