uu-parsinglib 2.4.1 → 2.4.2
raw patch · 5 files changed
+21/−72 lines, 5 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG +0/−24
- README +0/−19
- src/Text/ParserCombinators/UU/CHANGELOG.hs +9/−4
- src/Text/ParserCombinators/UU/Core.hs +6/−20
- uu-parsinglib.cabal +6/−5
− CHANGELOG
@@ -1,24 +0,0 @@-Versions above 2.1: - * based on Control.Applicative-Versions above 2.2:- * make use of type families - * contain a module with many list-based derived combinators-Version 2.3.1- * fix for GHC 6.12, because of change in GADT definition handling-Version 2.3.2- * added microsteps, which can be used to disambiguate-Version 2.3.3- * added pMunch which takes a Boolean function, and recognises the longest prefix for which the symbols match the predicate - * added the infix operator with piority 2 <?> :: P state a -> String -> P st a which replaces the list of expected symbols- in error message by its right argument String-Version 2.3.4- * removed dependecies on impredictaive types, preparing for next GHC version-Version 2.4.0- * contains abstract interpretation for minimal lenth, in order to avoid recursive correction process- * idem for checking that no repeating combinators like pList are parameterised with possibly empty parsers---Note that the basic parser interface will probably not change much when we add more features, but the calling conventions-of the outer parser and the class structure upon which the parametrisation is based may change- . -
− README
@@ -1,19 +0,0 @@----- Short Description--This repository contains a completely new version of the Utrecht parser combinator library.-This library is under construction.----- Background material--The library is based on ideas described in the paper:--@inproceedings{uuparsing:piriapolis, Author = {Swierstra, S.~Doaitse}, Booktitle = {Language Engineering and Rigorous Software Development}, Editor = {Bove, A. and Barbosa, L. and Pardo, A. and and Sousa Pinto, J.}, Pages = {252-300}, Place = {Piriapolis}, Publisher = {Spinger}, Series = {LNCS}, Title = {Combinator Parsers: a short tutorial}, Volume = {5520}, Year = {2009}} which is also available as a technical report from http://www.cs.uu.nl/research/techreps/repo/CS-2008/2008-044.pdf --The first part of this report is a general introduction into parser combinators, whereas the second part contains the -motivation for and documentation of the current package.--We appreciate if you include a reference to the above documentation in any publication describing software in which you have used the library succesfully.--Any feedback on particular use of the library, and suggestions for extensions, are welcome at mailto:doaitse@swierstra.net-
src/Text/ParserCombinators/UU/CHANGELOG.hs view
@@ -1,5 +1,10 @@ -- | This module just contains the CHANGELOG+-- Version 2.4.2 --+-- * fixed dependency in cabal file to base >=4.2+--+-- * moved definition of <$ to the class Functor and removed the class ExtApplicative +-- -- Version 2.4.1 -- -- * added the module Text.ParserCombinators.Merge for recognizing alternating sequences@@ -8,7 +13,7 @@ -- -- * beautified Haddock documentation ----- | Version 2.4.0+-- Version 2.4.0 -- -- * contains abstract interpretation for minimal lenth, in order to avoid recursive correction process --@@ -16,18 +21,18 @@ -- -- * lots of Haddcock doumentation in "Text.ParserCombinators.UU.Examples" ----- Version 2.3.4+-- Version 2.3.4 -- -- * removed dependecies on impredictaive types, preparing for next GHC version ----- Version 2.3.3+-- Version 2.3.3 -- -- * added `pMunch` which takes a Boolean function, and recognises the longest prefix for which the symbols match the predicate -- -- * added the infix operator with piority 2 @\<?> :: P state a -> String -> P state a@ which replaces the list of expected symbols -- in error message by its right argument String ----- Version 2.3.2+-- Version 2.3.2 -- -- * added microsteps, which can be used to disambiguate --
src/Text/ParserCombinators/UU/Core.hs view
@@ -16,7 +16,7 @@ module Text.ParserCombinators.UU.Core ( module Text.ParserCombinators.UU.Core , module Control.Applicative) where-import Control.Applicative hiding ((<$), many, some, optional)+import Control.Applicative hiding (many, some, optional) import Char import Debug.Trace import Maybe@@ -27,19 +27,11 @@ -- | This class collects a number of classes which together defines what a `Parser` should provide. -- Since it is just a predicate we have prefixed the name by the phrase `Is' -class (Applicative p, ExtApplicative p, Alternative p) => IsParser p where-instance (Applicative p, ExtApplicative p, Alternative p) => IsParser p where+class (Applicative p, Alternative p) => IsParser p where+instance (Applicative p, Alternative p) => IsParser p where -infixl 4 <$ infix 2 <?> --- ** `ExtApplicative'--- | The module "Control.Applicative" contains the definition for `<$` which cannot be changed . --- Since we want to give optimised implementations of this combinator, we hide its definition, and define a class containing its signature.--class ExtApplicative p where- (<$) :: a -> p b -> p a- -- ** `Symbol' -- | Many parsing libraries do not make a distinction between the terminal symbols of the language recognised and the -- tokens actually constructed from the input. This happens e.g. if we want to recognise an integer or an identifier: we are also interested in which integer occurred in the input, @@ -95,7 +87,10 @@ (pr) l (fmap f me)+ f <$ (P _ _ qr ql qe) + = P ( qr . ($f)) (\ k st -> push f (qr k st)) qr ql (case qe of Nothing -> Nothing; _ -> Just f) + -- ** Parsers are Applicative: @`<*>`@, @`<*`@, @`*>`@ and @`pure`@ instance Applicative (P state) where P ph pf pr pl pe <*> ~(P qh qf qr ql qe) = P ( \ k -> ph (\ pr -> qh (\ qr -> k (pr qr))))@@ -268,15 +263,6 @@ in pr (\st2' -> k (back st2')) st2) pl pe ----- ** A more efficient version for @`<$`@ from the module @`Control.Applicative`@--- | In the new module `Control.Applicative' the operator `<$` is still hard coded. --- We hide this import and provide an implementation using a class, which can be redfined when needed.--instance ExtApplicative (P st) where- f <$ (P _ _ qr ql qe) - = P ( qr . ($f)) (\ k st -> push f (qr k st)) qr ql (case qe of Nothing -> Nothing; _ -> Just f) -- * Maintaining Progress Information -- | The data type @`Steps`@ is the core data type around which the parsers are constructed.
uu-parsinglib.cabal view
@@ -1,12 +1,11 @@ Name: uu-parsinglib-Version: 2.4.1+Version: 2.4.2 Build-Type: Simple License: MIT Copyright: S Doaitse Swierstra License-file: LICENSE-Extra-source-files: CHANGELOG, README Author: Doaitse Swierstra, Utrecht University-Maintainer: Doaitse Swierstra +Maintainer: Doaitse Swierstra Stability: stable, but evolving Homepage: http://www.cs.uu.nl/wiki/bin/view/HUT/ParserCombinators Bug-reports: mailto:doaitse@swierstra.net@@ -16,7 +15,7 @@ annotation free, applicative style parser combinators. In addition to this we even provide a monadic interface. Parsers do analyse themselves to avoid commonly made errors .- The file "Text.ParserCombinators.UU.Examples" contains a ready-made main function,+ The module "Text.ParserCombinators.UU.Examples" contains a ready-made main function, which can be called to see the error correction at work. It contains extensive haddock documentation; try all the small tests for yourself to see the correction process at work, and to get a feeling for how to use the various combinators.@@ -25,12 +24,14 @@ . The file "Text.ParserCombinators.UU.README" contains some references to background information .+ Version 2.4.2 fixes a dependency in the .cabal file and has made the class + ExtApplicative obsolete since <$ is now in the class Functor Category: Parsing Library hs-source-dirs: src - Build-Depends: base >= 4 && <5, haskell98+ Build-Depends: base >= 4.2 && <5, haskell98 Exposed-modules: Text.ParserCombinators.UU Text.ParserCombinators.UU.CHANGELOG Text.ParserCombinators.UU.README