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

Safe Haskell None Haskell2010

ADP.Fusion.Core

Description

Generalized fusion system for grammars.

This module re-exports only the core functionality.

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

(<<<) :: (RuleContext i, Build x, MkStream m (Stack x) i, Element (Stack x) i, Apply (Arg (Stack x) -> b)) => Fun (Arg (Stack x) -> b) -> x -> i -> i -> 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.

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

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

Combine two RHSs to give a choice between parses.

(...) :: (t3 -> t2 -> t1) -> (t1 -> t) -> t3 -> 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.