ADPfusion-0.5.1.0: Efficient, high-level dynamic programming.

Safe HaskellNone
LanguageHaskell2010

ADP.Fusion

Description

Generalized fusion system for grammars.

NOTE Symbols typically do not check bound data for consistency. If you, say, bind a terminal symbol to an input of length 0 and then run your grammar, you probably get errors, garbled data or random crashes. Such checks are done via asserts in non-production code.

Synopsis

Documentation

(<<<) :: (Build x, MkStream m (Stack x) r, Element (Stack x) r, RuleContext r, Apply (Arg (Stack x) -> b)) => Fun (Arg (Stack x) -> b) -> x -> r -> r -> Stream m b infixl 8 Source

Apply a function to symbols on the RHS of a production rule. Builds the stack of symbols from xs using build, then hands this stack to mkStream together with the initial iniT telling mkStream that we are in the "outer" position. Once the stream has been created, we map getArg to get just the arguments in the stack, and finally apply the function f.

(<<#) :: (Build x, MkStream m (Stack x) r, Element (Stack x) r, RuleContext r, Apply (Arg (Stack x) -> m b)) => Fun (Arg (Stack x) -> m b) -> x -> r -> r -> Stream m b infixl 8 Source

(|||) :: Monad m => (t -> t1 -> Stream m a) -> (t -> t1 -> Stream m a) -> t -> t1 -> Stream m a infixl 7 Source

Combine two RHSs to give a choice between parses.

(...) :: (t1 -> t2 -> r) -> (r -> t) -> t1 -> t2 -> t infixl 5 Source

Applies the objective function h to a stream s. The objective function reduces the stream to a single optimal value (or some vector of co-optimal things).

(~~) :: a -> b -> Pair a b infixl 9 Source

Separator between RHS symbols.

(%) :: a -> b -> Pair a b infixl 9 Source

This separator looks much paper "on paper" and is not widely used otherwise.