- data FLBaseIx ix
- data FLManyIx ix
- data FoldLoopsDomain phi ix where
- FLBase :: phi ix -> FoldLoopsDomain phi (FLBaseIx ix)
- FLMany :: phi ix -> FoldLoopsDomain phi (FLManyIx ix)
- data family FoldLoopsValue r ix
- data family FoldLoopsResultValue r rr ix
- processFoldLoops :: forall phi r rr. GProcessor phi r rr -> GProcessor (FoldLoopsDomain phi) (FoldLoopsValue r) (FoldLoopsResultValue r rr)
- foldLoops :: GExtendedContextFreeGrammar phi t r rr -> GContextFreeGrammar (FoldLoopsDomain phi) t (FoldLoopsValue r) (FoldLoopsResultValue r rr)
- foldAndProcessLoops :: forall phi t r. Token t => ProcessingExtendedContextFreeGrammar phi t r -> ProcessingContextFreeGrammar (FoldLoopsDomain phi) t (FoldLoopsValue r)
Documentation
A parametrised type such that FLBaseIx
ix represents
base non-terminal ix.
DomainMap (FoldLoopsDomain phi) phi FLBaseIx | |
Show (r ix) => Show (FoldLoopsValue r (FLBaseIx ix)) |
DomainMap (FoldLoopsDomain phi) phi FLManyIx | |
Show (r ix) => Show (FoldLoopsValue r (FLManyIx ix)) |
data FoldLoopsDomain phi ix whereSource
FoldLoopsDomain phi defines, for base domain phi, an
extended domain containing non-terminal types
FLBaseIx
ix representing base non-terminal ix, and
FLManyIx
ix representing a Kleene-* version of base
non-terminal ix.
FLBase :: phi ix -> FoldLoopsDomain phi (FLBaseIx ix) | |
FLMany :: phi ix -> FoldLoopsDomain phi (FLManyIx ix) |
data family FoldLoopsValue r ix Source
FoldLoopsValue defines, for a semantic value family
r over base domain phi, a semantic value family
FoldLoopsValue
r over domain FoldLoopsDomain
r, such
that the semantic value for base non-terminal FLBaseIx
is a wrapped version of type r ix, and for Kleene-* non-terminal
FLManyIx
a wrapped version of type [r ix].
data family FoldLoopsResultValue r rr ix Source
FoldLoopsResultValue defines, for semantic value families
r and rr over base domain phi, a semantic value family
FoldLoopsResultValue
r rr over domain FoldLoopsDomain
r.
such that the semantic value for base non-terminal FLBaseIx
is a wrapped version of type rr ix, and for Kleene-* non-terminal
FLManyIx
a wrapped version of type [r ix].
processFoldLoops :: forall phi r rr. GProcessor phi r rr -> GProcessor (FoldLoopsDomain phi) (FoldLoopsValue r) (FoldLoopsResultValue r rr)Source
Construct a processor for a grammar transformed using the foldLoops
algorithm,
given a processor for the original grammar.
foldLoops :: GExtendedContextFreeGrammar phi t r rr -> GContextFreeGrammar (FoldLoopsDomain phi) t (FoldLoopsValue r) (FoldLoopsResultValue r rr)Source
Transform a given extended context-free grammar over a domain phi
into a standard
context-free grammar over the extended domain FoldLoopsDomain
phi
.
Calls to manyRef
idx are transformed into calls to ref
(FLMany
idx),
where FLMany
idx is a new non-terminal representing the
Kleene-* version of underlying non-terminal idx
. Normal
calls to ref
idx are transformed into calls to ref
(FLBase
idx) where FLBase
idx represents the unmodified
underlying non-terminal idx
. The foldLoops
algorithm
constructs appropriate production rules for both types of
new non-terminals.
Values are wrapped in the FoldLoopsResultValue
r
rr
semantic value family.
foldAndProcessLoops :: forall phi t r. Token t => ProcessingExtendedContextFreeGrammar phi t r -> ProcessingContextFreeGrammar (FoldLoopsDomain phi) t (FoldLoopsValue r)Source
Transform a given processing extended context-free
grammar over a domain phi
into a standard context-free
grammar over the extended domain 'FoldLoopsDomain phi'.
Completely similar to foldLoops
, but wraps values in the
FoldLoopsValue
r
semantic value family.