|
Version 5 (modified by ross@…, 7 years ago)
|
|
--
|
Replacing the Read Class
Problems with the Haskell 98 class
- the backtracking parser is very inefficient
- writing instances is painful, compared to a monadic interface
- on failure, parsers give no indication of what went wrong
Proposed replacements
- parsers based on ReadP, from Parallel Parsing Processes by Koen Classen, JFP 2004.
- monadic interface
- supports nondeterminism without needing explicit committed choice
- mostly deterministic parsers are much more efficient than ReadS
- no error reporting
- requires PolymorphicComponents
- GHC has used a new Read class based on these parsers since 5.04 (July 2002).
- Malcolm's experimental Poly parser in the CVS version of HaXml.
- monadic interface
- supports non-determinism but also has deterministically committed path (like cut operator in prolog)
- returns an error string on failure
- Could also use something based on Daan's Parsec combinators
- monadic interface
- mostly deterministic, with explicit 'try' operator for non-determinism
- error-reporting
- already widely used for other parsing tasks
Tickets
- #61
- replace the Read class
Download in other formats: