Killing the comma operator

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Wed May 11 11:36:11 PDT 2016


On Wed, May 11, 2016 at 05:55:27PM +0000, deadalnix via Digitalmars-d wrote:
> On Wednesday, 11 May 2016 at 16:44:43 UTC, H. S. Teoh wrote:
> >That's what I've been saying, it should be treated as a special case
> >in the syntax of for-loops, but not as an operator in general.
> >
> 
> Please no special cases.

You misunderstand, what I mean is that the comma should be *part of*
for-loop syntax, instead of being part of expression syntax. I.e.,
for-loop grammar should read something like this:

for-loop:
	"for" "(" loop-init ";" loop-condition ";" loop-increment ")" block

loop-init:
	comma-separated-exprs

loop-condition:
	comma-separated-exprs

loop-increment:
	comma-separated-exprs

comma-separated-exprs:
	expression
	expression "," comma-separated-exprs

And the grammar for expression should have zero references to comma
operators.


T

-- 
The right half of the brain controls the left half of the body. This means that only left-handed people are in their right mind. -- Manoj Srivastava


More information about the Digitalmars-d mailing list