| ... | @@ -32,17 +32,19 @@ |
... | @@ -32,17 +32,19 @@ |
|
|
|
|
|
|
|
GHC has used a new `Read` class based on these parsers since 5.04 (July 2002).
|
|
GHC has used a new `Read` class based on these parsers since 5.04 (July 2002).
|
|
|
|
|
|
|
|
- Malcolm's experimental [ Poly parser](http://nhc98.blogspot.com/#113301726218243351) in the development version of [ HaXml](http://www.cs.york.ac.uk/fp/HaXml-1.14/).
|
|
- Malcolm's experimental [ Poly TextParser](http://nhc98.blogspot.com/#113301726218243351) in the development version of [ HaXml](http://www.cs.york.ac.uk/fp/HaXml-1.14/).
|
|
|
|
|
|
|
|
- monadic interface, invoked with
|
|
- monadic interface, invoked with
|
|
|
|
|
|
|
|
```wiki
|
|
```wiki
|
|
|
runParser :: Parser t a -> [t] -> (Either String a, [t])
|
|
runParser :: TextParser a -> String -> (Either String a, String)
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
(This is essentially the internal representation.)
|
|
(The internal representation is more general, parameterised on token type.)
|
|
|
- choice operator commits to the first successful alternative
|
|
- returns only the first successful alternative, but with internal backtracking,
|
|
|
|
and an explicit commit operator to prevent backtracking where necessary
|
|
|
- on failure, returns an error string and the unparsed input
|
|
- on failure, returns an error string and the unparsed input
|
|
|
|
- failure messages can be defined/combined/nested with convenient combinators
|
|
|
|
|
|
|
|
- Could also use something based on Daan's [ Parsec](http://www.cs.uu.nl/people/daan/parsec.html) combinators
|
|
- Could also use something based on Daan's [ Parsec](http://www.cs.uu.nl/people/daan/parsec.html) combinators
|
|
|
|
|
|
| ... | | ... | |