Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell98 |
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 inpFindSubExpr
. - 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
- buggySymbol :: Symbol
- orSymbol :: Symbol
- andSymbol :: Symbol
- varSymbol :: Symbol
- ltSymbol :: Symbol
- matchSymbol :: Symbol
- magicVarSymbol :: Symbol
- magicNatSymbol :: Symbol
- magicNumberSymbol :: Symbol
- labelSymbol :: Symbol
- stopSymbol :: Symbol
- simSymbol :: Symbol
- noSimSymbol :: Symbol
- subSymbol :: Symbol
- (<!>) :: Expr -> Expr -> Expr
- (<?>) :: Expr -> Expr -> Expr
- (<&>) :: Expr -> Expr -> Expr
- var :: String -> Expr
- lt :: String -> Expr -> (Expr -> Expr) -> Expr
- matchExpr :: Expr -> Expr
- newMagicVar :: Expr
- newMagicNat :: Expr
- newMagicNumber :: Expr
- lbl :: String -> Expr -> Expr
- lblE :: String -> Expr -> Expr -> Expr
- stop :: Expr -> Expr
- sim :: Expr -> Expr
- noSim :: Expr -> Expr
- sub :: Expr -> Expr
Documentation
buggySymbol :: Symbol Source #
matchSymbol :: Symbol Source #
labelSymbol :: Symbol Source #
stopSymbol :: Symbol Source #
noSimSymbol :: Symbol Source #
(<!>) :: 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.
newMagicVar :: Expr Source #
Matches any variable
newMagicNat :: Expr Source #
Matches any natural number
newMagicNumber :: Expr Source #
Matches any number
lblE :: String -> Expr -> Expr -> Expr Source #
Same as lbl
, but also includes an expression in the label.
An expression must be completely simplified before we consider it to be matched.