logo       

Re: [Haskell-cafe] mistake in Gentle Introduction: msg#00086

lang.haskell.glasgow.bugs

Subject: Re: [Haskell-cafe] mistake in Gentle Introduction


On 22-sep-05, at 11:20, Tomasz Zielonka wrote:

On 9/22/05, Simon Marlow <simonmar@xxxxxxxxxxxxx> wrote:

> The error message on this is really poor: parse error on input
> `length'
>
> An addition like "expecting '('" might be more helpful.

Not easy to do - some significant work on Happy would be required (or
rewriting GHC's parser, which is even more unlikely).

However we *would* like to do some simple error recovery in the parser
at some point.  The main reason for doing this is to get better results
from checking partially complete modules in Visual Haskell or hIDE.
How about using the parser made by Arthur Baars, trading speed for better error messages?
Maybe even the speed issue could be solved.

Speed, error messages and recovery were not my main concern when writing the parser. I think a lot can be gained by optimizing the combinator-based parsers. However this is no fun. I had to do some left-factorization to gain reasonable efficiency(at first the speed was sometimes worse than 1 token per minute :-)). For a complex language such as Haskell, the code resulting from factorization is really messy and the notational elegance of the combinators is lost. Maybe someone can write a parser-generator that uses Doaitses parsing-engine as a back-end :-)

A main feature of Doaitses parsing-combinators is that they can recover from an error in the input. This is done by considering a number of alternatives to "repair" the input, and taking the "best" one to continue parsing. This proces can be improved by tweaking the insert and delete costs of certain symbols. Furthermore the error messages can be customized as with Parsec.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise