A bytestring implementation of reg exp pattern matching using partial derivative
This algorithm exploits the extension of partial derivative of regular expression patterns.
This algorithm implements the POSIX matching policy proceeds by scanning the input word from right to left.

>mapping::D.Dictionary(Pat,Int)->Pat->Int>mappingdictionaryx=letcandidates=D.lookupAll(D.hashx)dictionary>incandidates`seq`>casecandidatesof>[(_,i)]->i>_->>caselookupxcandidatesof>(Justi)->i>Nothing->error("this should not happen. looking up "++(prettyx)++" from "++(showcandidates))

>-- | algorithm right to left scanning single pass>-- | the "partial derivative" operations among integer states + binders>lookupPdPat0'::PdPat0TableRev->(Int,Binder)->Letter->[(Int,Binder,Int,Bool)]>lookupPdPat0'hash_table(i,b)(l,x)=>caseIM.lookup(my_hashil)hash_tableof>Justquatripples->[(j,opxb,p,gf)|(j,op,p,gf)<-quatripples]>Nothing->[]

a function that updates the binder given an index (that is the pattern var)
ASSUMPTION: the var index in the pattern is linear. e.g. no ( 0 :: R1, (1 :: R2, 2 :: R3))

>updateBinderByIndex::Int-- ^ pattern variable index>->Int-- ^ letter position>->Binder->Binder>updateBinderByIndexilposbinder=>updateBinderByIndexSublposibinder>>updateBinderByIndexSub::Int->Int->Binder->Binder>updateBinderByIndexSubposidx[]=[]>updateBinderByIndexSubposidx(x@(idx',(b,e):rs):xs)>|pos`seq`idx`seq`idx'`seq`xs`seq`False=undefined>|idx==idx'&&pos==(b-1)=(idx',(b-1,e):rs):xs>|idx==idx'&&pos<(b-1)=(idx',(pos,pos):(b,e):rs):xs>|idx==idx'&&pos>(b-1)=error"impossible, the current letter position is greater than the last recorded letter">|otherwise=x:(updateBinderByIndexSubposidxxs)>updateBinderByIndexSubposidx(x@(idx',[]):xs)>|pos`seq`idx`seq`idx'`seq`xs`seq`False=undefined>|idx==idx'=((idx',[(pos,pos)]):xs)>|otherwise=x:(updateBinderByIndexSubposidxxs)

>-- | Control whether the pattern is multiline or case-sensitive like Text.Regex and whether to>-- capture the subgroups (\1, \2, etc). Controls enabling extra anchor syntax.>dataCompOption=CompOption{>caseSensitive::Bool-- ^ True in blankCompOpt and defaultCompOpt>,multiline::Bool>{- ^ False in blankCompOpt, True in defaultCompOpt. Compile for
> newline-sensitive matching. "By default, newline is a completely ordinary
> character with no special meaning in either REs or strings. With this flag,
> inverted bracket expressions and . never match newline, a ^ anchor matches the
> null string after any newline in the string in addition to its normal
> function, and the $ anchor matches the null string before any newline in the
> string in addition to its normal function." -}>,rightAssoc::Bool-- ^ True (and therefore Right associative) in blankCompOpt and defaultCompOpt>,newSyntax::Bool-- ^ False in blankCompOpt, True in defaultCompOpt. Add the extended non-POSIX syntax described in "Text.Regex.TDFA" haddock documentation.>,lastStarGreedy::Bool-- ^ False by default. This is POSIX correct but it takes space and is slower.>-- Setting this to true will improve performance, and should be done>-- if you plan to set the captureGroups execoption to False.>}deriving(Read,Show)

>dataExecOption=ExecOption{>captureGroups::Bool-- ^ True by default. Set to False to improve speed (and space).>}deriving(Read,Show)

Searched text: "a"
Regex pattern: "(..)*(...)*"
Expected output: "(0,0)(-1,-1)(-1,-1)"
Actual result : "(1,1)(-1,-1)(-1,-1)"
because it is an unanchored match, "a" is matched by the -1 sub group??
but in the expected output, it should be matched by the -2 sub group??