[Haskell-cafe] ANNOUNCE: uu-parsinglib version 2.5.3; extended with merging combinators

S. Doaitse Swierstra doaitse at swierstra.net
Thu Aug 5 05:24:57 EDT 2010


I have uploaded a new version of the uu-parsinglib. It contains, besides the extension of the abstract interpretation part and the fixing of some very subtle corner cases in that part, some nice new functionality:

The call of the parser:

-- run ((,,,) `pMerge` (pSome pa <||> pMany pb <||> pOne pc <||>  pNatural `pOpt` 5)) "babc45a"

results in:

-- > Result: (["a", "a"],["b","b"],"c",45)

and

-- run ((,,,) `pMerge` (pSome pa <||> pMany pb <||> pOne pc <||>  pNatural `pOpt` 5)) "bbc"

results in

-- > Result: (["a"],["b","b"],"c",5)
-- > Correcting steps: 
-- >    Inserted 'a' at position (0,3) expecting one of ['0'..'9', 'b', 'a']
-- 


pSome means that the number of elements occurring in the input should be >= 1
pMany                                                                    >= 0
pOne                                                                      = 1
pOpt                                                                     <= 1

The implementation can be found in the Derived module, and is remarkably simple.

Doaitse







More information about the Haskell-Cafe mailing list