2 ms·
This would be easier with languages where keywords are in clear and consistent syntactic positions and identifiers can match keywords (that is, the keywords are
by Jtsummers 6y ago
This would be easier with languages where keywords are in clear and consistent syntactic positions and identifiers can match keywords (that is, the keywords are only "kind of" special, more by position than value).
Otherwise, you'll run into issues when someone is using Language X but has identifiers that happen to coincide with Language Y's keywords. You wouldn't want to error out here, and you don't want Language X writers to be forced to be aware of the many hundreds of extra keywords that are now required knowledge to avoid collisions and permit universal translation.
For instance, in a programming language which uses `and` as a keyword in English for the logical operation, this would be translated into Spanish as `y`. Well, in graphical applications `y` is a perfectly natural variable name for the English speaker (and probably the Spanish speaker, but their dialect of the language wouldn't permit it). Now the English program can't be translated properly into Spanish unless the syntax is such that variables and keywords are always unambiguous so that this can be legal in the Spanish version:
y < 0 y x > 10
y < 0 and x > 10
Of course, switching to a language which prefers symbols over keywords would help to minimize this issue (as in C where `and` is not a keyword, in contrast with Ada where `and` is a keyword).