Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- (<<<) :: (Apply (Arg (Stack x) -> b), RuleContext s, Element (Stack x) s, MkStream m (Stack x) s, Build x) => Fun (Arg (Stack x) -> b) -> x -> s -> s -> Stream m b
- (<<#) :: (Apply (Arg (Stack x) -> m b), RuleContext s, Element (Stack x) s, MkStream m (Stack x) s, Build x) => Fun (Arg (Stack x) -> m b) -> x -> s -> s -> Stream m b
- (|||) :: Monad m => (t -> t1 -> Stream m a) -> (t -> t1 -> Stream m a) -> t -> t1 -> Stream m a
- (...) :: (t1 -> t2 -> s) -> (s -> t) -> t1 -> t2 -> t
- (~~) :: a -> b -> Pair a b
- (%) :: a -> b -> Pair a b
- module ADP.Fusion.Apply
- module ADP.Fusion.Base
- module ADP.Fusion.Term
- module ADP.Fusion.SynVar
- module ADP.Fusion.TH
Documentation
(<<<) :: (Apply (Arg (Stack x) -> b), RuleContext s, Element (Stack x) s, MkStream m (Stack x) s, Build x) => Fun (Arg (Stack x) -> b) -> x -> s -> s -> 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
.
(<<#) :: (Apply (Arg (Stack x) -> m b), RuleContext s, Element (Stack x) s, MkStream m (Stack x) s, Build x) => Fun (Arg (Stack x) -> m b) -> x -> s -> s -> 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 -> s) -> (s -> 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
This separator looks much paper "on paper" and is not widely used otherwise.
module ADP.Fusion.Apply
module ADP.Fusion.Base
module ADP.Fusion.Term
module ADP.Fusion.SynVar
module ADP.Fusion.TH