context-free grammar

%u wfunction at hotmail.com
Sun Mar 6 23:16:33 PST 2011


> That's essentially the example that's been under discussion - though in this case it's a ref instead of
a temporary for the lvalue. Regardless, it's context free because a * b is by definition a variable
declaration, not a call to the multiplication operator. If you want it to use the multiplication
operator, then use parens: (a * b) = b. It's context free, because it just assumes one of the two and
it's _always_ that one, so there's no ambiguity. It is, _by definition_, a variable declaration.

Oh, I see. So is multiplication being special-cased in the grammar, or is it part of a more general rule
in the language?


> Also, opMul is on its way to deprecation. binaryOp should be used for overloading the multiplication
operator.

Whoa! I did not know that; thanks.


More information about the Digitalmars-d mailing list