When programmers say that a character is illegal or that a particular way of overriding a method is legal, what exactly do they mean? Does "illegal" simply mean the programming language does not allow it, or can it refer to something else?
3 Answers
In programming, “legal” usually means permitted by the rules of the language. An illegal character, statement, or method override violates those rules, so the compiler or interpreter may reject it, or the program may fail when it runs. There are no actual legal consequences—it’s just terminology borrowed from everyday language.
People sometimes use “legal” to mean syntactically valid, meaning the code follows the language’s grammar and can be parsed or compiled. Other times they mean that an operation is allowed by the language’s semantics or type system. In either case, “illegal” generally means the language tools reject it or it does not behave as a permitted operation.
It’s similar to calling an incorrect move in chess “illegal.” A knight moving in a straight line breaks the rules of chess; likewise, code is illegal when it breaks the syntax or rules defined by the programming language. For example, using an unsupported character in an identifier or overriding a method with an incompatible signature may be rejected.

Related Questions
How To: Running Codex CLI on Windows with Azure OpenAI
Set Wordpress Featured Image Using Javascript
How To Fix PHP Random Being The Same
Why no WebP Support with Wordpress
Replace Wordpress Cron With Linux Cron
Customize Yoast Canonical URL Programmatically