Module
Parsing.Expr
- Package
- purescript-parsing
- Repository
- purescript-contrib/purescript-parsing
This module is a port of the Haskell Text.Parsec.Expr module.
#OperatorTable Source
type OperatorTable :: (Type -> Type) -> Type -> Type -> Type
type OperatorTable m s a = Array (Array (Operator m s a))
#buildExprParser Source
buildExprParser :: forall m s a. 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