The attached should correct the following productions that are allowed
by the current BNF in Annex A:
new undefined()
new null()
null()
null.a()
5()
5.a
++++a
a++++
++\n\n\n\n LeftHandSideExpression
null=5
5=5
this=6
Note: NaN and undefined aren't included in A.1 Lexical Grammar;
however, Infinity is. Is this by design? My proposal adds them
to A.1.
In spite of being NumericLiterals, Infinity and NaN are currently
referrable e.g. Infinity.a NaN.a. This is reflected in my
proposal, but should probably be removed as referable if
compatability isn't a concern here.
Let me know if there is anything that you find objectionable. I submit
this with all humility, so feel free to critique / reject it in any way
you see fit.
-Joe
On Fri, 2012-09-07 at 10:37 -0700, Brendan Eich wrote:
> Joseph Spencer wrote:
> > Would it not be beneficial to bring Annex A into greater conformity with
> > the rest of the spec at this point?
>
> Maybe, but there's non-zero risk and the work has non-trivial
> opportunity cost. If you can come up with a minimal set of changes and
> propose them here, I'll take a look and see if TC39 has the budget to
> consider them.
>
> /be
> >
> > Such changes seem relatively safe (to a noobie that is ;), as any code
> > produced moving forward by devs would still parse just fine under older
> > implementations that allowed for the unwanted syntax. It seems that
> > doing so would also bring the ecosystem of implementations into greater
> > alignment moving forward.
> >
> > -Joe
> >
> > On Thu, 2012-09-06 at 16:41 -0700, Brendan Eich wrote:
> >> Joseph Spencer wrote:
> >>> My apologies on that one. I meant to type the following:
> >>>
> >>> PostfixExpression:
> >>> LeftHandSideExpression [no LineTerminator here] ++
> >>> LeftHandSideExpression [no LineTerminator here] --
> >>>
> >>> PrefixExpression:
> >>> ++ [no LineTerminator here] LeftHandSideExpression
> >>> -- [no LineTerminator here] LeftHandSideExpression
> >>>
> >>> It appears to me that as currently written the following is considered
> >>> valid sytax:
> >>>
> >>> ++++someVar;
> >> Yes, that is goofy. It dates back to ES1 -- if memory serves (and it may
> >> not at this late date), my original Netscape 2 "Mocha" JS engine did not
> >> parse this.
> >>
> >> However, I think it may fall out of a desire by Microsoft back in the
> >> ES1 days to support the goofy ability of "host objects" to return
> >> References (ECMA-262 spec term).
> >>
> >>
> >>> I hadn't thought about es3 compatability though, so I could see the
> >>> reasoning in keeping it as is.
> >> Yeah, engine implementors have no good incentive to tweak here, and some
> >> legitimate fear of a breaking change that would only lose market share.
> >>
> >> /be
> >
> >
> >
A.1 Lexical Grammar
...
Literal::
NonReferableLiteral
ReferableLiteral
NonReferableLiteral::
NullLiteral
NumericLiteral
UndefinedLiteral
ReferableLiteral::
Infinity
NaN
BooleanLiteral
StringLiteral
...
A.3 Expressions
PrimaryExpression : See 11.1
ReferablePrimaryExpression
NonReferablePrimaryExpression
NonReferablePrimaryExpression:
NonReferableLiteral
ReferablePrimaryExpression:
this
Identifier
ReferableLiteral
ArrayLiteral
ObjectLiteral
FunctionExpression
ParenthesizedExpression
ParenthesizedExpression:
( Expression )
ArrayLiteral : See 11.1.4
[ Elisionopt ]
[ ElementList ]
[ ElementList , Elisionopt ]
ElementList : See 11.1.4
Elisionopt AssignmentExpression
ElementList , Elisionopt AssignmentExpression
Elision : See 11.1.4
,
Elision ,
ObjectLiteral : See 11.1.5
{ }
{ PropertyNameAndValueList }
{ PropertyNameAndValueList , }
PropertyNameAndValueList : See 11.1.5
PropertyAssignment
PropertyNameAndValueList , PropertyAssignment
PropertyAssignment : See 11.1.5
PropertyName : AssignmentExpression
get PropertyName ( ) { FunctionBody }
set PropertyName ( PropertySetParameterList ) { FunctionBody }
PropertyName : See 11.1.5
IdentifierName
StringLiteral
NumericLiteral
PropertySetParameterList : See 11.1.5
Identifier
MemberExpression : See 11.2
ReferablePrimaryExpression RefinementExpression
RefinementExpression:
RefinementExpression opt [ Expression ]
RefinementExpression opt . IdentifierName
Instantiable:
FunctionExpression
CallExpression
Callable
New:
new
New new
NewExpression : See 11.2
New Instantiable
Callable:
Identifier
MemberExpression
ParenthesizedExpression
CallExpression : See 11.2
Callable Call
Call:
Call opt RefinementExpression opt Arguments
Arguments : See 11.2
( )
( ArgumentList )
ArgumentList : See 11.2
AssignmentExpression
ArgumentList , AssignmentExpression
LeftHandSideExpression : See 11.2
Identifier
MemberExpression
PostfixExpression : See 11.3
LeftHandSideExpression [no LineTerminator here] ++
LeftHandSideExpression [no LineTerminator here] --
PrefixExpression:
++ [no LineTerminator here] LeftHandSideExpression
-- [no LineTerminator here] LeftHandSideExpression
UnaryExpression : See 11.4
NewExpression
CallExpression
PrimaryExpression
LeftHandSideExpression
PostfixExpression
PrefixExpression
delete UnaryExpression
void UnaryExpression
typeof UnaryExpression
+ UnaryExpression
- UnaryExpression
~ UnaryExpression
! UnaryExpression
A.1 Lexical Grammar
...
Literal::
+ NonReferableLiteral
+ ReferableLiteral
+
+NonReferableLiteral::
NullLiteral
+ NumericLiteral
+ UndefinedLiteral
+
+ReferableLiteral::
+ Infinity
+ NaN
BooleanLiteral
- NumericLiteral
StringLiteral
...
A.3 Expressions
PrimaryExpression : See 11.1
+ ReferablePrimaryExpression
+ NonReferablePrimaryExpression
+
+NonReferablePrimaryExpression:
+ NonReferableLiteral
+
+ReferablePrimaryExpression:
this
Identifier
- Literal
+ ReferableLiteral
ArrayLiteral
ObjectLiteral
+ FunctionExpression
+ ParenthesizedExpression
+
+ParenthesizedExpression:
( Expression )
ArrayLiteral : See 11.1.4
Identifier
MemberExpression : See 11.2
- PrimaryExpression
+ ReferablePrimaryExpression RefinementExpression
+
+RefinementExpression:
+ RefinementExpression opt [ Expression ]
+ RefinementExpression opt . IdentifierName
+
+Instantiable:
FunctionExpression
- MemberExpression [ Expression ]
- MemberExpression . IdentifierName
- new MemberExpression Arguments
+ CallExpression
+ Callable
+New:
+ new
+ New new
+
NewExpression : See 11.2
+ New Instantiable
+
+Callable:
+ Identifier
MemberExpression
- new NewExpression
+ ParenthesizedExpression
CallExpression : See 11.2
- MemberExpression Arguments
- CallExpression Arguments
- CallExpression [ Expression ]
- CallExpression . IdentifierName
+ Callable Call
+Call:
+ Call opt RefinementExpression opt Arguments
+
Arguments : See 11.2
( )
( ArgumentList )
ArgumentList , AssignmentExpression
LeftHandSideExpression : See 11.2
- NewExpression
- CallExpression
+ Identifier
+ MemberExpression
PostfixExpression : See 11.3
- LeftHandSideExpression
LeftHandSideExpression [no LineTerminator here] ++
LeftHandSideExpression [no LineTerminator here] --
+PrefixExpression:
+ ++ [no LineTerminator here] LeftHandSideExpression
+ -- [no LineTerminator here] LeftHandSideExpression
+
UnaryExpression : See 11.4
+ NewExpression
+ CallExpression
+ PrimaryExpression
+ LeftHandSideExpression
PostfixExpression
+ PrefixExpression
delete UnaryExpression
void UnaryExpression
typeof UnaryExpression
- ++ UnaryExpression
- -- UnaryExpression
+ UnaryExpression
- UnaryExpression
~ UnaryExpression
! UnaryExpression
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss