The entire point is, why must it be replaced/insertatian by a keyword?????
Because the programmer typed a keyword - specifically "while" - that's one reason why. The other reasons are , because putting a semicolon before the "else" does not create a valid statement and, there is a "begin" that is expecting an "end" which is the only keyword that doesn't start another statement that is valid in that case. Those are the reasons why.
So the expected token can very well be a ";".
No, because a ";" in that case violates the rules of the Pascal grammar, therefore ";" there, is not a possibility that leads to a syntactically valid program.
Delphis error message is completely wrong, there is no case in which While ... do end would be correct.
In that case, all the Pascal compilers that compile this are "completely wrong":
program TestErrorMessage;
begin
while 1 > 2 do
end.
That might be why Borland replaced the name "Pascal" with Delphi. Since Free Pascal compiles that and, according to you
"there is no case in which While ... do end would be correct.", maybe it should be called Free "Fred" (abbreviated F2... sounds like a fighter jet.)
The parser does not know at the moment of parsing the else that it is inside the statement block of the while-statement, it simply tries to read a statement (which can also be a begin … end block).
But, there is one thing the parser knows with complete certainty which is, it was not parsing an "if" statement because if it had been parsing an "if" statement, the "if" production would have consumed the "else". Therefore, the parser knows that "else" in that location is incorrect.
Since, the "while" production is done and there is no "if", control returns to the compound statement production and that one know that "else" isn't a statement therefore no separating semicolon is valid. Therefore, the only correct symbol, that does not start another statement, in that location is "end".
Anyway, I have the answer to my question... this is the first time and, the last one, I bring up anything about the correctness (or lack thereof) of error messages.
In any case, thank you for the explanation, I do appreciate it.