Maintainer | bastiaan.heeren@ou.nl |
---|---|

Stability | provisional |

Portability | portable (depends on ghc) |

Safe Haskell | None |

Language | Haskell98 |

Basic machinery for fully executing a core strategy expression, or only
partially. Partial execution results in a prefix that keeps the current
locations in the strategy (a list of `Path`

s) for continuing the execution
later on. A path can be used to reconstruct the sequence of steps already
performed (a so-called trace). Prefixes can be merged with the Monoid
operation.

- runCore :: Core a -> a -> [a]
- data Prefix a
- noPrefix :: Prefix a
- makePrefix :: Core a -> a -> Prefix a
- replayCore :: Path -> Core a -> ([Step a], a -> Prefix a)
- isEmptyPrefix :: Prefix a -> Bool
- majorPrefix :: Prefix a -> Prefix a
- searchModePrefix :: (Step a -> Step a -> Bool) -> Prefix a -> Prefix a
- prefixPaths :: Prefix a -> [Path]
- data Step a
- stepRule :: Step a -> Rule a
- stepEnvironment :: Step a -> Environment
- data Path
- emptyPath :: Path
- readPath :: Monad m => String -> m Path
- readPaths :: Monad m => String -> m [Path]

# Running `Core`

strategies

# Prefix

makePrefix :: Core a -> a -> Prefix a Source

Make a prefix from a core strategy and a start term.

replayCore :: Path -> Core a -> ([Step a], a -> Prefix a) Source

Construct a prefix by replaying a path in a core strategy: the third argument is the current term.

isEmptyPrefix :: Prefix a -> Bool Source

majorPrefix :: Prefix a -> Prefix a Source

Transforms the prefix such that only major steps are kept in the remaining strategy.

searchModePrefix :: (Step a -> Step a -> Bool) -> Prefix a -> Prefix a Source

The searchModePrefix transformation changes the process in such a way that all intermediate states can only be reached by one path. A prerequisite is that symbols are unique (or only used once).

prefixPaths :: Prefix a -> [Path] Source

Returns the current `Path`

.

# Step

The steps during the parsing process: enter (or exit) a labeled sub-strategy, or a rule.

stepEnvironment :: Step a -> Environment Source

# Path

A path encodes a location in a strategy. Paths are represented as a list of integers.