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

Stability | provisional |

Portability | portable (depends on ghc) |

Safe Haskell | None |

Language | Haskell98 |

This module defines the subexpression recognizer. If you wish to extend the language that the subexpression recognizer accepts, see Recognize.SubExpr.Symbols Common functions can be found in Recognize.SubExpr.Functions If you wish to make use of the parameters of the recognizer see Recognize.SubExpr.SEParser Finally, if you want to change/view the comparison functions see Recognize.SubExpr.Compare Throughout the code you may find log statements. Logging is only visible if debug mode is on. The algorithm is still a WIP and doesn't look very polished. It is however in a usable state (see exercises theatrerate, pattern, vpattern and matryoshka).

## Synopsis

- pMatchSubSteps :: Expr -> SEParser (Expr, [Step])

# Documentation

pMatchSubSteps :: Expr -> SEParser (Expr, [Step]) Source #

Accepts an expression for matching with input expressions

The algorithm parses an input as long as it matches against the given expression. Input can be matched in 4 different ways.

- Input matches exactly (module commutativity, associativity)
- Input matches simplified
- Input matches exactly (..) against a subexpression
- Input matches simplified against a subexpression

A small example: Given an expression 1 + 2, we can match against several different combinations of input: [1,2,1+2,3,3] [3,3,3] [2,1,3] etc

Note that we can no longer match an input if we had already parsed an simplified form of this input, unless the