First off, I didn't study computer science, I'm just interested in the subject.
I have read that e.g. having to declare a variable before its use is a context-sensitive aspect of programming languages.
My question is: Could you provide a production rule that is the equivalent of "declare a variable before its use" along with the actual code?
I haven't seen a context sensitive production rule yet where it was clear to me how that would actually look in the code later or vice versa, look at code and then derive the production rule.
Or maybe some other context-sensitive feature or Java (aren't generics context-sensitive, as well?).
EDIT:
As an example:
https://en.wikipedia.org/wiki/Context-sensitive_grammar#Examples
Can you provide a piece of code that would show this grammar in use? How would this grammar look in an actual programme? It's just that those aabababccbab-type examples are a bit abstract.