Let's stop parser Hell

Jacob Carlborg doob at me.com
Tue Jul 10 13:40:17 PDT 2012


On 2012-07-10 22:25, Jonathan M Davis wrote:

> Which is horrible. You pretty much have to with HTML because of the horrid
> decision that it should be parsed so laxly by browsers, but pretty much
> nothing else should do that. Either it's correct or it's not. Having the
> compiler "fix" your code would cause far more problems that it would ever fix.

I'm not sure but I think he was referring to a kind of error reporting 
technique used by compilers. Example:

int foo ()
{
    int a = 3 // note the missing semicolon
    return a;
}

Instead of the parser going completely mad because of the missing 
semicolon. It will basically insert a semicolon, report the error and 
then happily continue parsing. I think this will make it easier to find 
later errors and less likely to report incorrect errors due to a 
previous error.

-- 
/Jacob Carlborg




More information about the Digitalmars-d mailing list