New syntax for comma expression

Richard Andrew Cattermole (Rikki) richard at cattermole.co.nz
Wed Nov 20 23:11:37 UTC 2024


During semantic analysis, some code gets lowered to the comma 
expression.

New'ing anonymous classes are a good example of this.

Right now if hdrgen were to emit it, it looks like this (-vcg-ast 
to get it):

```
__anonclass1 foo = Object, LeInterface
{
	void* this;
}
, foo = new __anonclass1;
```

Proposed grammar:

```diff
CommaExpression:
+   "class" ConstructorArgs|opt AnonBaseClassList|opt 
AggregateBody
+   "__commaExpr" '(' CommaExpression ')'
```

This would not break code, nor would it affect tuples. No new AST 
nodes or semantic behaviour. Just hooking an existing language 
feature to be fully expressable in syntax.

Ideally, this would be able to bypass the DIP process, due to the 
bug-fixing nature of it.


More information about the dip.ideas mailing list