Safe Haskell | None |
---|---|
Language | Haskell2010 |
Collection of small helper functions for grammars.
- isTerminal :: Symbol -> Bool
- isBindableTerminal :: Symbol -> Bool
- isSyntactic :: Symbol -> Bool
- isSynStacked :: Symbol -> Bool
- isAllSplit :: Symbol -> Bool
- splitK0 :: Symbol -> Symbol
- splitToFull :: Symbol -> Symbol
- isSynTerm :: Symbol -> Bool
- isEpsilon :: Symbol -> Bool
- dim :: Grammar -> Int
- uniqueTermsWithTape :: Grammar -> [(SynTermEps, Tape)]
- uniqueBindableTermsWithTape :: Grammar -> [(SynTermEps, Tape)]
- uniqueSynVarsWithTape :: Grammar -> [(SynTermEps, Tape)]
- uniqueSynTermsWithTape :: Grammar -> [(SynTermEps, Tape)]
- uniqueSynTermEpsWithTape :: [Symbol] -> [(SynTermEps, Tape)]
- uniqueTerminalSymbols :: Grammar -> [Symbol]
- uniqueBindableTerminalSymbols :: Grammar -> [Symbol]
- uniqueSyntacticSymbols :: Grammar -> [Symbol]
- uniqueSynTermSymbols :: Grammar -> [Symbol]
- normalizeStartEpsilon :: Grammar -> Grammar
- isLeftLinear :: Grammar -> Bool
- isRightLinear :: Grammar -> Bool
- isLinear :: Grammar -> Bool
Documentation
isTerminal :: Symbol -> Bool Source #
Term
, Deletion
, and Epsilon
all count as terminal symbols.
isBindableTerminal :: Symbol -> Bool Source #
Term
, and Epsilon
are terminal symbols that can be bound.
isSyntactic :: Symbol -> Bool Source #
Only SynVar
s are non-terminal.
isSynStacked :: Symbol -> Bool Source #
special case of single-tape synvar in multi-tape setting
isAllSplit :: Symbol -> Bool Source #
true if we have a split synvar
splitToFull :: Symbol -> Symbol Source #
Take a split symbol and rewrite as full.
dim :: Grammar -> Int Source #
Dimension of the grammar. Rather costly, because we check for dimensional consistency.
uniqueTermsWithTape :: Grammar -> [(SynTermEps, Tape)] Source #
Extract single-tape terminals together with their tape dimension.
uniqueBindableTermsWithTape :: Grammar -> [(SynTermEps, Tape)] Source #
Extract single-tape bindable terminals together with their tape dimension.
uniqueSynVarsWithTape :: Grammar -> [(SynTermEps, Tape)] Source #
uniqueSynTermsWithTape :: Grammar -> [(SynTermEps, Tape)] Source #
uniqueSynTermEpsWithTape :: [Symbol] -> [(SynTermEps, Tape)] Source #
uniqueTerminalSymbols :: Grammar -> [Symbol] Source #
Return the nub list of terminal symbols. This includes Deletion
symbols, and might not be what you want. Check
uniqueBindableTerminalSymbols
too!
uniqueSyntacticSymbols :: Grammar -> [Symbol] Source #
Return the nub list of syntactic symbols.
uniqueSynTermSymbols :: Grammar -> [Symbol] Source #
Return the nub list of syntactic terminals.
normalizeStartEpsilon :: Grammar -> Grammar Source #
TODO Currently a stub (original is in .Grammar
still. Want to have it
monadically, as the code is a mess.
isLeftLinear :: Grammar -> Bool Source #
Left-linear grammars have at most one non-terminal on the RHS. It is the first symbol.
isRightLinear :: Grammar -> Bool Source #