ideas-1.3.1: Feedback services for intelligent tutoring systems

Maintainerbastiaan.heeren@ou.nl
Stabilityprovisional
Portabilityportable (depends on ghc)
Safe HaskellNone
LanguageHaskell98

Ideas.Common.Strategy.Parsing

Contents

Description

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 Paths) 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.

Synopsis

Running Core strategies

runCore :: Core a -> a -> [a] Source

Run a Core strategy and return all results.

Prefix

data Prefix a Source

Instances

Show (Prefix a) 
Monoid (Prefix a) 
Firsts (Prefix a) 
type Elem (Prefix a) = (Step a, a) 

noPrefix :: Prefix a Source

The error prefix (i.e., without a location in the strategy).

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.

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

data Step a Source

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

Constructors

Enter Id

Enter a labeled sub-strategy

Exit Id

Exit a labeled sub-strategy

RuleStep Environment (Rule a)

Rule that was applied

Instances

Apply Step 
Eq (Step a) 
Show (Step a) 
Minor (Step a) 
HasId (Step a) 

Path

data Path Source

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

Instances

emptyPath :: Path Source

The empty path.