Safe Haskell | None |
---|---|
Language | Haskell2010 |
Direct product of two grammars.
Currently implemented for linear grammars. Once we move to context-free grammars with more than one non-terminal on the RHS, things become interesting.
Documentation
directProduct :: Semigroup (Linear a) => a -> a -> a Source #
mergeRHS :: [Symbol] -> [Symbol] -> [Symbol] Source #
Merges right-hand sides in a linear direct product. For full-fledged CFGs in different normal forms, see the GNF and CNF implementations.
TODO get prefix, get single NT, get suffix ;;; merge prefixes, merge single NTs, merge suffixes ;;; and in case of no NTs? prefer prefixes?