Let's stop parser Hell

David Piepgrass qwertie256 at gmail.com
Sat Jul 7 18:15:29 PDT 2012


On Saturday, 7 July 2012 at 22:35:37 UTC, Roman D. Boiko wrote:
> On Saturday, 7 July 2012 at 22:25:00 UTC, David Piepgrass wrote:
>> This is all true, but forgetting a brace commonly results in a 
>> barrage of error messages anyway. Code that guesses what you 
>> meant obviously won't work all the time, and phase 3 would 
>> have to take care not to emit an error message about a "{" 
>> token that doesn't actually exist (that was merely 
>> "guessed-in"). But at least it's nice for a parser to be 
>> /able/ to guess what you meant; for a typical parser it would 
>> be out of the question, upon detecting an error, to back up 
>> four source lines, insert a brace and try again.
>
> So you simply admit that error recovery is difficult to 
> implement. For me, it is a must-have, and thus throwing away 
> information is bad.

I'm not seeing any tremendous error-handling difficulty in my 
idea. Anyway, I missed the part about information being thrown 
away...?


More information about the Digitalmars-d mailing list