Safe Haskell | None |
---|---|
Language | Haskell2010 |
Symantics for regular grammars.
Synopsis
Type Reg
newtype Reg (lr :: Side) g a Source #
Left or right regular grammar.
Instances
reg_of_Terminal :: Terminal g a -> Reg lr g a Source #
Class Gram_Alt
class Gram_Alt g where Source #
Like Alternative
but without the Applicative
super-class,
because a regular grammar is not closed under Applicative
.
Type Gram_Try
class Gram_Try g where Source #
Explicit backtracking.
To get more accurate error messages,
it is helpful to backtrack (put try
constructors)
only when the grammar actually has another alternative
that could match, instead of always backtracking
all previous alternatives, as in: try
a
<+>
b
Class Gram_RegR
class (Functor g, Gram_Alt g) => Gram_RegR g where Source #
Symantics for right regular grammars.
(.*>) :: Terminal g (a -> b) -> RegR g a -> RegR g b infixl 4 Source #
Class Gram_RegL
class (Functor g, Gram_Alt g) => Gram_RegL g where Source #
Symantics for left regular grammars.
(<*.) :: RegL g (a -> b) -> Terminal g a -> RegL g b infixl 4 Source #