For example (in C):
int break = 1;
int for = 2;
Why will the compiler have any problems at all in deducing that break
and fo
In many cases, it would be possible for the compiler to interprete keywords as normal identifiers, like in your example:
int break = 1;
int for = 2;
As a matter of fact, I just wrote a compiler for a simple assembly-like toy language which does this, but warns the user in such cases.
But sometimes the syntax is defined in a way that keywords and identifiers are ambiguous:
int break;
while(...)
{
break; // <-- treat this as expression or statement?
}
And the most obvious reason is that editors will emphasize keywords so that the code is more readable for humans. Allowing keywords to be treated as identifiers would make code highlighting harder, and would also lead to bad readability of your code.