Maintainer bastiaan.heeren@ou.nl provisional portable (depends on ghc) None Haskell98

Recognize.SubExpr.Symbols

Description

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:

• Create the symbol and corresponding Expr constructor in this module
• Add a function named pFindSubXXX, in Recognize.SubExpr.Recognizer. Add a call to that function in pFindSubExpr.
• Add existence functions in Recognize.SubExpr.Functions.
• Some functions in Recognize.SubExpr.Functions may require modification, such as cleanExpr. Make sure you thoroughly go over the functions in that file and modify where necessary.
Synopsis

# Documentation

(<!>) :: 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

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.

Tells us that an expression has been matched by the recognizer

Matches any variable

Matches any natural number

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.

Stops further traversing into the expression

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

No simplification allowed

Turns of simplification in the recognizer

First requires a normalized matching before a simplified form can match