Earley-0.13.0.1: Parsing all context-free grammars using Earley's algorithm.

Text.Earley.Mixfix

Synopsis

# Documentation

Constructors

 LeftAssoc NonAssoc RightAssoc
Instances
 Source # Instance detailsDefined in Text.Earley.Mixfix Methods Source # Instance detailsDefined in Text.Earley.Mixfix MethodsshowList :: [Associativity] -> ShowS #

type Holey a = [Maybe a] Source #

An identifier with identifier parts (Justs), and holes (Nothings) representing the positions of its arguments.

Example (commonly written "if_then_else_"): [Just "if", Nothing, Just "then", Nothing, Just "else", Nothing] :: Holey String

Arguments

 :: [[(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.

Arguments

 :: [[(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.