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

Recognize.Parsing.Interpretation

Description

Synopsis

# Documentation

toStep p parses p and captures Math and returns a Step

interpret e represents the correct interpretation of e without any attributes assigned

pStepEq parses a (chained) equation.

(>*<) :: Interpretation -> Interpretation -> Interpretation infixl 7 Source #

>*< represents the correct representation of *

(>+<) :: Interpretation -> Interpretation -> Interpretation infixl 5 Source #

>+< represents the correct interpretation of + regardless of mistakes in the arguments

(>>*<<) :: Interpretation -> Interpretation -> Interpretation infixl 7 Source #

x >>*<< y generates possible interpretations (correct and erroneous) for multiplying an interpretation of x with an interpretation of y, for now we assume the interpretations x and y are monomial or binomial (because specific to Rectangle Area exercise)

(>>+<<) :: Interpretation -> Interpretation -> Interpretation infixl 5 Source #

x >>+<< y represents the correct and erroneous interpretation of +.

(>>/<<) :: Interpretation -> Interpretation -> Interpretation infixl 7 Source #

x >>/<< y generates possible interpretations (correct and erroneous) for division the erroneous interpretation consists of distributing division over multiplication, eg: (a*b2 - a2*b/2)

pNamedStep n a represents an Interpretation that can be named (L = ..), but still requires the concept to be explicitly written down. (e.g. @pNamedStep (interpret (Var L)) (interpret (3+1)) succeeds on "3+1", "L=3+1", "L=4" but not on L

getMatchEnvironment :: ExprParseState -> Map String Expr Source #

the match environment contains matches for wildcards

pStep a i parses interpretation i and assigns attribute a (as identifier) We first try to see if we can match an equation e = e then we try to see if we can match a single expression e otherwise we try to see if we can match an equation * = e, or e = * where * is a wildcard

sum'' xs represents the correct and incorrect representation of sum

sum' xs represents correct interpretation of summation

initialState :: ExprParseState Source #