Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data Associativity
- type Holey a = [Maybe a]
- mixfixExpression :: [[(Holey (Prod r e t ident), Associativity)]] -> Prod r e t expr -> (Holey ident -> [expr] -> expr) -> Grammar r (Prod r e t expr)
- mixfixExpressionSeparate :: [[(Holey (Prod r e t ident), Associativity, Holey ident -> [expr] -> expr)]] -> Prod r e t expr -> Grammar r (Prod r e t expr)
Documentation
data Associativity Source #
:: [[(Holey (Prod r e t ident), Associativity)]] | A table of holey identifier parsers, with associativity information. The identifiers should be in groups of precedence levels listed from binding the least to the most tightly. The associativity is taken into account when an identifier starts or ends with holes, or both. Internal holes (e.g. after "if" in "if_then_else_") start from the beginning of the table. Note that this rule also applies to identifiers with multiple consecutive holes, e.g. "if__" --- the associativity then applies to both holes. |
-> Prod r e t expr | An atom, i.e. what is parsed at the lowest level. This will commonly be a (non-mixfix) identifier or a parenthesised expression. |
-> (Holey ident -> [expr] -> expr) | How to combine the successful application of a holey identifier to its arguments into an expression. |
-> Grammar r (Prod r e t expr) |
Create a grammar for parsing mixfix expressions.
mixfixExpressionSeparate Source #
:: [[(Holey (Prod r e t ident), Associativity, Holey ident -> [expr] -> expr)]] | A table of holey identifier parsers, with associativity information and semantic actions. The identifiers should be in groups of precedence levels listed from binding the least to the most tightly. The associativity is taken into account when an identifier starts or ends with holes, or both. Internal holes (e.g. after "if" in "if_then_else_") start from the beginning of the table. Note that this rule also applies to identifiers with multiple consecutive holes, e.g. "if__" --- the associativity then applies to both holes. |
-> Prod r e t expr | An atom, i.e. what is parsed at the lowest level. This will commonly be a (non-mixfix) identifier or a parenthesised expression. |
-> Grammar r (Prod r e t expr) |
A version of mixfixExpression
with a separate semantic action for each
individual Holey
identifier.