Embarrassingly Simple Spec Question
I think it's
- AssignmentExpression (tc39.github.io/ecma262/#prod-AssignmentExpression)
- ConditionalExpression (tc39.github.io/ecma262/#prod-ConditionalExpression)
- LogicalORExpression (tc39.github.io/ecma262/#prod-LogicalORExpression)
- LogicalANDExpression (tc39.github.io/ecma262/#prod-LogicalANDExpression)
- BitwiseORExpression (tc39.github.io/ecma262/#prod-BitwiseORExpression)
- BitwiseXORExpression (tc39.github.io/ecma262/#prod-BitwiseXORExpression)
- BitwiseANDExpression (tc39.github.io/ecma262/#prod-BitwiseANDExpression)
- EqualityExpression (tc39.github.io/ecma262/#prod-EqualityExpression)
- RelationalExpression (tc39.github.io/ecma262/#prod-RelationalExpression)
- ShiftExpression (tc39.github.io/ecma262/#prod-ShiftExpression)
- AdditiveExpression (tc39.github.io/ecma262/#prod-AdditiveExpression)
- MultiplicativeExpression (tc39.github.io/ecma262/#prod-MultiplicativeExpression)
- ExponentiationExpression (tc39.github.io/ecma262/#prod-ExponentiationExpression)
- UnaryExpression (tc39.github.io/ecma262/#prod-UnaryExpression)
- UpdateExpression (tc39.github.io/ecma262/#prod-UpdateExpression)
- LeftHandSideExpression (tc39.github.io/ecma262/#prod-LeftHandSideExpression)
- NewExpression (tc39.github.io/ecma262/#prod-NewExpression)
- MemberExpression (tc39.github.io/ecma262/#prod-MemberExpression)
- PrimaryExpression (tc39.github.io/ecma262/#prod-PrimaryExpression)
- IdentifierReference (tc39.github.io/ecma262/#prod-IdentifierReference)
- Identifier (tc39.github.io/ecma262/#prod-Identifier)
Very obscure indeed.
On Tue, May 22, 2018 at 11:03 AM, Oriol _ <oriol-bugzilla at hotmail.com>
wrote:
I think it's
Crikey. I started down that path but gave up after about seven steps on the assumption I had to be going down a blind alley. Teach me not to stick it out. I guess there must be some good reason not to include PrimaryExpression in AssignmentExpression directly (ambiguity or some such).
Thanks!!
-- T.J. Crowder
That's the usual means of specifying precedence in anything remotely like BNF. ;-)
(IIUC It could be duplicated in PrimaryExpression, but it'd just get unruly real quick if you were to try to expand everything.)
Isiah Meadows me at isiahmeadows.com, www.isiahmeadows.com
On Wed, May 23, 2018 at 1:29 PM, Isiah Meadows <isiahmeadows at gmail.com>
wrote:
That's the usual means of specifying precedence in anything remotely like BNF. ;-)
(IIUC It could be duplicated in PrimaryExpression, but it'd just get unruly real quick if you were to try to expand everything.)
Yeah, this is just a weak area for me. Apologies all. I should have just kept clicking, but when I got to BitwiseXORExpression I figured I had to be off-piste. ;-)
-- T.J. Crowder
Embarrassingly, I'm struggling to follow the spec through a simple assignment expression. :-) If someone would bear with me and explain the below, I'd be very grateful.
I'm looking at a simple assignment:
x = y
. I have no trouble with the runtime semantics, but I'm having trouble with the syntax productions, specifically howy
matches AssignmentExpression. Details of what (I think) I know and where I've gotten lost:In Assignment Operators, I can see that
x = y
is an AssignmentExpression matching the second-to-last bullet:So far so good.
x
would be the LeftHandSideExpression andy
would be the AssignmentExpression in that production.And I'm fine with
x
.x
is a LeftHandSideExpression and I can follow through NewExpression to MemberExpression to PrimaryExpression to IdentifierReference.But looking at the syntax for AssignmentExpression above, I can't see how
y
matches it.y
is an IdentifierReference, right? Starting from the six productions above, I can't get to IdentifierReference, or to any other production that seems to me to matchy
. It seems like PrimaryExpression should be on that list. But it isn't, and I'm sure it isn't for a reason.It's a dead simple thing, clearly (and embarrassingly) there's just some fundamental point or concept I'm missing.
Thanks in advance,
-- T.J. Crowder