Why underscores in "__data"? Is this just a temporary thing?
I don't have much experience with grammars but I feel like the more contextual the parsing rule the more likely there will be nasty edge cases.
There isn't an inherent restriction on context-free grammars why this couldn't happen. In pseudocode this could work fine:
classDef = accessModifier? classModifier* `class` identifier `{`
(fieldDef|methodDef|classDef)*
`}`
fieldDef = accessModifier? fieldModifier* type identifier `=` expression
classModifier = `data`
fieldModifier = `synchronized` | `final` | `volatile`
As you can see there isn't an inherent reason why the identifier rule should exclude the `data` keyword for this to workOtherwise I really like this proposal. I absolutely love the ability to do D structuring, and I like the idea that they’re going to make it possible to make these immutable as well.