GrammarProducts 0.1.0.0 → 0.1.1.0
raw patch · 6 files changed
+59/−61 lines, 6 filesdep ~ADPfusiondep ~FormalGrammarsdep ~PrimitiveArrayPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: ADPfusion, FormalGrammars, PrimitiveArray
API changes (from Hackage documentation)
Files
- FormalLanguage/GrammarProduct/Op/Add.hs +3/−2
- FormalLanguage/GrammarProduct/Op/Linear.hs +10/−9
- FormalLanguage/GrammarProduct/Op/Subtract.hs +10/−9
- GrammarProducts.cabal +14/−35
- README.md +16/−6
- changelog.md +6/−0
FormalLanguage/GrammarProduct/Op/Add.hs view
@@ -1,7 +1,7 @@ module FormalLanguage.GrammarProduct.Op.Add where -import Control.Lens hiding (outside)+import Control.Lens hiding (outside,indices) import Control.Lens.Fold import Control.Newtype import Data.List (genericReplicate)@@ -43,10 +43,11 @@ (l^.rules <> r^.rules) -- s (l^.params <> r^.params)+ (l^.indices <> r^.indices) (l^.grammarName <> r^.grammarName) False where s | l^.start == r^.start = l^.start- | l^.start /= mempty && r^.start /= mempty = error "add new start symbol"+ | l^.start /= mempty && r^.start /= mempty = l^.start -- error "add new start symbol" -- TODO to be discussed ?! | l^.start == mempty = r^.start | r^.start == mempty = l^.start
FormalLanguage/GrammarProduct/Op/Linear.hs view
@@ -9,7 +9,7 @@ import Control.Arrow ((&&&)) import Data.Semigroup-import Control.Lens hiding (outside)+import Control.Lens hiding (outside,indices) import Control.Applicative import qualified Data.Set as S import Data.List (groupBy,nub)@@ -30,14 +30,15 @@ instance Semigroup (Linear Grammar) where- (Linear g) <> (Linear h) = Linear $ Grammar sv st tv io rs s p (g^.grammarName ++ h^.grammarName) False where -- ts ns es rs s (g^.name <> h^.name) where- sv = M.fromList . nub . map (_name &&& id) . concatMap _getSymbolList . uniqueSyntacticSymbols $ set rules rs def -- build a temporary @def@ grammar, extract symbols from that one- st = g^.synterms <> h^.synterms- tv = g^.termvars <> h^.termvars- io = g^.outside- rs = S.fromList [ direct l r | l <- g^..rules.folded, r <- h^..rules.folded ]- s = (g^.start) <> (h^.start)- p = (g^.params) <> (h^.params)+ (Linear g) <> (Linear h) = Linear $ Grammar sv st tv io rs s p ixs (g^.grammarName ++ h^.grammarName) False where -- ts ns es rs s (g^.name <> h^.name) where+ sv = M.fromList . nub . map (_name &&& id) . concatMap _getSymbolList . uniqueSyntacticSymbols $ set rules rs def -- build a temporary @def@ grammar, extract symbols from that one+ st = g^.synterms <> h^.synterms+ tv = g^.termvars <> h^.termvars+ io = g^.outside+ rs = S.fromList [ direct l r | l <- g^..rules.folded, r <- h^..rules.folded ]+ s = (g^.start) <> (h^.start)+ p = (g^.params) <> (h^.params)+ ixs = (g^.indices) <> (h^.indices) direct l r = Rule (l^.lhs <> r^.lhs) (l^.attr <> r^.attr) (mergeRHS (l^.rhs) (r^.rhs)) {- ts = g^.tsyms <> h^.tsyms
FormalLanguage/GrammarProduct/Op/Subtract.hs view
@@ -3,7 +3,7 @@ import Control.Arrow ((&&&)) import Control.Lens.Fold-import Control.Lens hiding (outside)+import Control.Lens hiding (outside,indices) import Control.Newtype import Data.List (genericReplicate) import Data.Semigroup@@ -24,14 +24,15 @@ | dim l /= dim r = error $ printf "grammars %s and %s have different dimensions, cannot unify. (subtract)" (show l) (show r) | l^.outside /= r^.outside = error $ printf "grammars %s and %s have different inside/outside annotation." (show l) (show r) | otherwise = g- where sv = M.fromList . map ((_name &&& id) . fst) . uniqueSynVarsWithTape $ g- st = M.fromList . map ((_name &&& id) . fst) . uniqueSynTermsWithTape $ g- tv = M.fromList . map ((_name &&& id) . fst) . uniqueBindableTermsWithTape $ g- io = l^.outside- rs = (l^.rules) S.\\ (r^.rules)- s = if (anyOf (folded . lhs) ((l^.start) ==) rs) then l^.start else Symbol []- p = M.union (l^.params) (r^.params)- g = Grammar sv st tv io rs s p (l^.grammarName ++ r^.grammarName) False+ where sv = M.fromList . map ((_name &&& id) . fst) . uniqueSynVarsWithTape $ g+ st = M.fromList . map ((_name &&& id) . fst) . uniqueSynTermsWithTape $ g+ tv = M.fromList . map ((_name &&& id) . fst) . uniqueBindableTermsWithTape $ g+ io = l^.outside+ rs = (l^.rules) S.\\ (r^.rules)+ s = if (anyOf (folded . lhs) ((l^.start) ==) rs) then l^.start else Symbol []+ p = M.union (l^.params) (r^.params)+ ixs = M.union (l^.indices) (r^.indices)+ g = Grammar sv st tv io rs s p ixs (l^.grammarName ++ r^.grammarName) False {- subtract l r
GrammarProducts.cabal view
@@ -1,8 +1,9 @@ name: GrammarProducts-version: 0.1.0.0+version: 0.1.1.0 author: Christian Hoener zu Siederdissen, 2013-2015 copyright: Christian Hoener zu Siederdissen, 2013-2015-homepage: http://www.bioinf.uni-leipzig.de/gADP/+homepage: https://github.com/choener/GrammarProducts+bug-reports: https://github.com/choener/GrammarProducts/issues maintainer: choener@bioinf.uni-leipzig.de category: Formal Languages, Bioinformatics license: GPL-3@@ -13,6 +14,8 @@ tested-with: GHC == 7.8.4, GHC == 7.10.1 synopsis: Grammar products and higher-dimensional grammars description:+ <http://www.bioinf.uni-leipzig.de/Software/gADP/ generalized Algebraic Dynamic Programming>+ . An algebra of liner and context-free grammars. . This library provides the implementation of our theory of@@ -35,25 +38,9 @@ pretty-printed in various ways (LaTeX, ANSI, Haskell module with signature and grammar). .- .- .- Formal background can be found in two papers:- .- @- Christian Höner zu Siederdissen, Ivo L. Hofacker, and Peter F. Stadler.- Product Grammars for Alignment and Folding.- 2014. IEEE/ACM Transactions on Computational Biology and Bioinformatics. 99.- <http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6819790>- @- .- and- .- @- Christian Höner zu Siederdissen, Ivo L. Hofacker, and Peter F. Stadler- How to Multiply Dynamic Programming Algorithms- Brazilian Symposium on Bioinformatics (BSB 2013)- Lecture Notes in Bioinformatics 8213, Springer, Heidelberg- @+ The formal background can be found in two papers given in the+ README. The gADP homepage has further details, tutorials,+ examples. . @@ -69,23 +56,20 @@ default: False manual: True -flag llvm- description: build using LLVM- default: False- manual: True - library build-depends: base >= 4.7 && < 4.9+ , ADPfusion >= 0.4.1 && < 0.4.2 , ansi-wl-pprint >= 0.6 && < 0.7 , bytestring >= 0.10 && < 0.11 , containers >= 0.5 && < 0.6 , data-default >= 0.5 && < 0.6- , FormalGrammars == 0.2.0.*+ , FormalGrammars >= 0.2.1 && < 0.2.2 , lens >= 4 && < 5 , newtype >= 0.2 && < 0.3 , parsers >= 0.12 && < 0.13+ , PrimitiveArray >= 0.6.0.1 && < 0.6.2 , semigroups >= 0.15 && < 0.17 , template-haskell >= 2 && < 3 , transformers >= 0.4 && < 0.5@@ -153,13 +137,13 @@ executable AlignGlobal if flag(examples) build-depends: base >= 4.7 && < 4.9- , ADPfusion == 0.4.0.*+ , ADPfusion , containers , FormalGrammars , GrammarProducts- , PrimitiveArray == 0.6.0.*+ , PrimitiveArray , template-haskell- , vector == 0.10.*+ , vector >= 0.10 && < 0.11 buildable: True else buildable: False@@ -183,11 +167,6 @@ -funbox-strict-fields -funfolding-use-threshold1000 -funfolding-keeness-factor1000- if flag(llvm)- ghc-options:- -fllvm- -optlo-O3- -fllvm-tbaa
README.md view
@@ -1,17 +1,27 @@-Grammar Products-================+# GrammarProducts: Products of formal languages [](https://travis-ci.org/choener/GrammarProducts) -[*generalized ADPfusion Homepage*](http://www.bioinf.uni-leipzig.de/Software/gADP/)+[*generalized Algebraic Dynamic Programming Homepage*](http://www.bioinf.uni-leipzig.de/Software/gADP/) An algebra of liner and context-free grammars. +1. Christian Höner zu Siederdissen, Ivo L. Hofacker, and Peter F. Stadler. + *Product Grammars for Alignment and Folding* + 2014, IEEE/ACM Transactions on Computational Biology and Bioinformatics. 99 + [paper](http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6819790) +1. Christian Höner zu Siederdissen, Ivo L. Hofacker, and Peter F. Stadler. + *How to Multiply Dynamic Programming Algorithms* + 2013, Brazilian Symposium on Bioinformatics (BSB 2013) + Lecture Notes in Bioinformatics 8213. Springer, Heidelberg. + [paper](http://dx.doi.org/10.1007/978-3-319-02624-4_8) [preprint](http://www.bioinf.uni-leipzig.de/Software/gADP/gramprod/hoe-hof-2013.pdf) + #### Contact -Christian Hoener zu Siederdissen-choener@bioinf.uni-leipzig.de-Leipzig University, Leipzig, Germany+Christian Hoener zu Siederdissen +Leipzig University, Leipzig, Germany +choener@bioinf.uni-leipzig.de +http://www.bioinf.uni-leipzig.de/~choener/
changelog.md view
@@ -1,3 +1,9 @@+0.1.1.0+-------++- FormalGrammar == 0.2.1.x with revamped indexed rules system+- new travis.yml+ 0.1.0.0 -------