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

Safe HaskellNone
LanguageHaskell2010

Text.Earley.Mixfix

Synopsis

Documentation

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

mixfixExpression Source

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 a hole, or both. Internal holes (e.g. after "if" in "if_then_else_") start from the beginning of the table.

-> 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 e (Prod r e t expr) 

Create a grammar for parsing mixfix expressions.