RE: A bug or incorrect logic?

> 
> Given that A is optional, shouldn't the error message 
> indicate that (at a minimum) "B or C" is expected?
> 

Designing good error messages tends to involve guessing what the user's
intention was. The message that this particular processor has given you is
what comes out easily from the usual strategy of compiling the grammar into
a finite state machine, where in any given state you know what symbols are
allowed to appear to move you to the next state. 

There are strategies that do better (spelling checkers use them, essentially
by trying to work out what valid construct your invalid construct is closest
to) but they tend to involve look-ahead, which means they don't scale well
when the content is very long. And as we know from spelling checkers, they
can sometimes produce hilarious results.

Michael Kay
http://www.saxonica.com/

Received on Friday, 31 October 2008 17:57:39 UTC