Module

Text.Parsing.Parser.Expr

Package
parsing
Repository
id3as/purescript-parsing

#Operator Source

data Operator :: (Type -> Type) -> Type -> Type -> Typedata Operator m s a

Constructors

#OperatorTable Source

type OperatorTable :: (Type -> Type) -> Type -> Type -> Typetype OperatorTable m s a = Array (Array (Operator m s a))

#buildExprParser Source

buildExprParser :: forall m s a. Monad m => OperatorTable m s a -> ParserT s m a -> ParserT s m a

Build a parser from an OperatorTable.

For example:

buildExprParser [ [ Infix (string "/" $> div) AssocRight ]
                , [ Infix (string "*" $> mul) AssocRight ]
                , [ Infix (string "-" $> sub) AssocRight ]
                , [ Infix (string "+" $> add) AssocRight ]
                ] digit