Advise-me-0.1: Assessment services for the Advise-Me project
Portabilityportable (depends on ghc)
Safe HaskellNone



This module defines the language of the subexpression recognizer.

We make use of the open data-type Expr to combine both already existing constructors and new constructors defined here.

If you want to add a new symbol to the language, you must do the following:



(<!>) :: Expr -> Expr -> Expr infixl 3 Source #

Gives us a way to say that matching to an expression is deemed incorrect.

It takes two expressions. Matching the first is correct and matching the second is 'incorrect.

Other than that, it behaves similarly to or.

(<?>) :: Expr -> Expr -> Expr infixl 3 Source #

or between expressions

Match the first or the second. It is possible for both to be matched.

(<&>) :: Expr -> Expr -> Expr infixl 0 Source #

and between expressions

Both expressions must be matched

var :: String -> Expr Source #

Mutable variable.

This is different from the Expr Var constructor in that this var acts as a reference to some expression.

It is also possible for this expression to change, but only from some magic expression type to some more concrete expression type.

lt :: String -> Expr -> (Expr -> Expr) -> Expr Source #

Let expression

Introduces mutable variables by assigning it some default value.

It takes a string to be used as an identifier (make sure it is unique). The default value and

a function whose argument is the introduced mutable variable.

matchExpr :: Expr -> Expr Source #

Tells us that an expression has been matched by the recognizer

newMagicVar :: Expr Source #

Matches any variable

newMagicNat :: Expr Source #

Matches any natural number

newMagicNumber :: Expr Source #

Matches any number

lbl :: String -> Expr -> Expr Source #

Label an expression (generates an Attribute)

lblE :: String -> Expr -> Expr -> Expr Source #

Same as lbl, but also includes an expression in the label.

stop :: Expr -> Expr Source #

Stops further traversing into the expression

sim :: Expr -> Expr Source #

An expression must be completely simplified before we consider it to be matched.

noSim :: Expr -> Expr Source #

No simplification allowed

Turns of simplification in the recognizer

sub :: Expr -> Expr Source #

First requires a normalized matching before a simplified form can match