Some bugs of Spec.

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Some bugs of Spec.

eric.suen
Hi,

From: http://www.compilercompany.com/es4/grammar.pdf

Qualifier ::= *
 | ReservedNamespace
 | Identifier
 
Because in spec., the Identifier has no boldface, so it conflict on
['internal', 'public'...] between Identifier and ReservedNamespace

QualifiedNameIdentifier ::= *
 | Identifier
 | ReservedIdentifier
 | String
 | Number
 | Brackets
 | OverloadedOperator
 
String should be StringLiteral and Number should be NumberLiteral?

ForInExpressionList ::= ForExpression
 | ForExpressionList ForExpression
 
There is no ForExpression and ForExpressionList, only ForInExpression
and ForInExpressionList

NullableTypeExpression ::= 'undefined'
 | TypeExpression
 
but TypeExpression -> TypeExpression -> PrimaryName -> PropertyName
 -> NonAttributeQualifiedName -> SimpleQualifiedName -> Identifier
 -> ContextuallyReservedIdentifier -> 'undefined'
 
ThisExpression ::= this
 | this callee
 | this generator
 
What is callee and generator? not found in ReservedIdentifier
or ContextuallyReservedIdentifier

BTW: where can I find the more recent spec.
 
Eric
--------------------------------------
Spket IDE - Development Tool for RIA
 
http://www.spket.com


      ___________________________________________________________
雅虎免费邮箱,全球第一邮箱品牌!
http://mail.yahoo.com.cn/

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

RE: Some bugs of Spec.

Jeff Dyer
Eric,

Good finds. I've posted an updated grammar, with some additional pending fixes, at the usual place.

As for an updated spec, one isn't yet available. But some good progress is currently being made on it.

Thanks,
Jd

> -----Original Message-----
> From: [hidden email] [mailto:es4-discuss-
> [hidden email]] On Behalf Of Eric Suen
> Sent: Sunday, August 19, 2007 1:49 AM
> To: [hidden email]
> Subject: Some bugs of Spec.
>
> Hi,
>
> From: http://www.compilercompany.com/es4/grammar.pdf
>
> Qualifier ::= *
>  | ReservedNamespace
>  | Identifier
>
> Because in spec., the Identifier has no boldface, so it conflict on
> ['internal', 'public'...] between Identifier and ReservedNamespace
>
> QualifiedNameIdentifier ::= *
>  | Identifier
>  | ReservedIdentifier
>  | String
>  | Number
>  | Brackets
>  | OverloadedOperator
>
> String should be StringLiteral and Number should be NumberLiteral?
>
> ForInExpressionList ::= ForExpression
>  | ForExpressionList ForExpression
>
> There is no ForExpression and ForExpressionList, only ForInExpression
> and ForInExpressionList
>
> NullableTypeExpression ::= 'undefined'
>  | TypeExpression
>
> but TypeExpression -> TypeExpression -> PrimaryName -> PropertyName
>  -> NonAttributeQualifiedName -> SimpleQualifiedName -> Identifier
>  -> ContextuallyReservedIdentifier -> 'undefined'
>
> ThisExpression ::= this
>  | this callee
>  | this generator
>
> What is callee and generator? not found in ReservedIdentifier
> or ContextuallyReservedIdentifier
>
> BTW: where can I find the more recent spec.
>
> Eric
> --------------------------------------
> Spket IDE - Development Tool for RIA
>
> http://www.spket.com
>
>
>       ___________________________________________________________
> 雅虎免费邮箱,全球第一邮箱品牌!
> http://mail.yahoo.com.cn/

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Some bugs of Spec.

Eric Suen-4
In reply to this post by eric.suen
Some more,

QualifiedNameIdentifier ::= '*'
 | OverloadedOperator
 | ...

But '*' already in OverloadedOperator

AttributeIdentifier not exists, should be AttributeName?

SwitchTypeStatement not be used in any other rules

ClassName be removed, but still be used in InterfaceDefinition and
FunctionDefinition

ParameterisedTypeName was removed, but still be used in TypeDefinition

BTW, will the final Spec. be LR(1)?

Regards,

Eric
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Some bugs of Spec.

Eric Suen-4
In reply to this post by eric.suen
Some typo:

TypeParametersList ::= Identifier
 | Identifier , TypeParameterList

TypeParametersList should be TypeParameterList

BitwiseAndExpression[a,b] ::= EqualityExpression[a,b]
 | BitwiseAndExpressionr[a,b] & EqualityExpression[a,b]

BitwiseAndExpressionr should be BitwiseAndExpression

InitaliserList ::= Initialiser
 | InitialiserList ',' Initialiser

InitaliserList should be InitialiserList

Regards

Eric

------------------------------------------------
Spket IDE - Development Tool for RIA.

http://www.spket.com
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Some bugs of Spec.

Jeff Dyer
Hi,

Updated grammar posted at (new location):

    http://www.ecmascript.org/es4/spec/grammar.pdf

Thanks again for the bug reports.

Also, we have no plans to write an LR(1) grammar for ES4. I'm not even sure
it is possible. Are you volunteering? :)

Jd





On 8/21/07 10:52 AM, Eric Suen wrote:

> Some typo:
>
> TypeParametersList ::= Identifier
>  | Identifier , TypeParameterList
>
> TypeParametersList should be TypeParameterList
>
> BitwiseAndExpression[a,b] ::= EqualityExpression[a,b]
>  | BitwiseAndExpressionr[a,b] & EqualityExpression[a,b]
>
> BitwiseAndExpressionr should be BitwiseAndExpression
>
> InitaliserList ::= Initialiser
>  | InitialiserList ',' Initialiser
>
> InitaliserList should be InitialiserList
>
> Regards
>
> Eric
>
> ------------------------------------------------
> Spket IDE - Development Tool for RIA.
>
> http://www.spket.com
> _______________________________________________
> Es4-discuss mailing list
> [hidden email]
> https://mail.mozilla.org/listinfo/es4-discuss

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Some bugs of Spec.

Eric Suen-4
Others:
Directive[t,w] ::= EmptyStatement
 | Statement[w]
 | AnnotatableDirective[t,w]

Statement[w] should be Statement[t, w]

ForInitialiser ::= $empty
 | ListExpression[allowColon,noIn]
 | VariableDefinition[noIn]

VariableDefinition[b,w] ::=
  VariableDefinitionKind VariableBindingList[b] Semicolon[w]

Since VariableDefinition has Semicolon, I don't think it should
be used in ForInitialiser

CaseElements ::= ...
 | CaseLabel CaseElementsPrefix Directive_abbrev

CaseElementsPrefix ::= ...
 | CaseElementsPrefix Directive_full

Directive_abbrev should be Directive_local_abbrev and Directive_full
should be Directive_local_full?

AnnotatableDirective[global,w] ::= ...
 | FunctionDefinition[global]
       
AnnotatableDirective[t,w] ::= ...
 | FunctionDefinition[t]

FunctionDefinition[global] should be FunctionDefinition[global,w],
FunctionDefinition[t] should be FunctionDefinition[t, w]

Eric

On 8/22/07, Jeff Dyer <[hidden email]> wrote:

> Hi,
>
> Updated grammar posted at (new location):
>
>     http://www.ecmascript.org/es4/spec/grammar.pdf
>
> Thanks again for the bug reports.
>
> Also, we have no plans to write an LR(1) grammar for ES4. I'm not even sure
> it is possible. Are you volunteering? :)
>
> Jd
>
>
>
>
>
> On 8/21/07 10:52 AM, Eric Suen wrote:
>
> > Some typo:
> >
> > TypeParametersList ::= Identifier
> >  | Identifier , TypeParameterList
> >
> > TypeParametersList should be TypeParameterList
> >
> > BitwiseAndExpression[a,b] ::= EqualityExpression[a,b]
> >  | BitwiseAndExpressionr[a,b] & EqualityExpression[a,b]
> >
> > BitwiseAndExpressionr should be BitwiseAndExpression
> >
> > InitaliserList ::= Initialiser
> >  | InitialiserList ',' Initialiser
> >
> > InitaliserList should be InitialiserList
> >
> > Regards
> >
> > Eric
> >
> > ------------------------------------------------
> > Spket IDE - Development Tool for RIA.
> >
> > http://www.spket.com
> > _______________________________________________
> > Es4-discuss mailing list
> > [hidden email]
> > https://mail.mozilla.org/listinfo/es4-discuss
>
>


--
------------------------------------------------
Spket IDE - Development Tool for RIA.

http://www.spket.com
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Question about spec

rasmus ekman-2
In reply to this post by eric.suen
Just an arbitrary newbie question...
I note that the updated UnaryExpression BNF
codifies part of the behaviour of ES-262 implementations:

UnaryExpression ->
        PostfixExpression
        | delete PostfixExpression
        | void UnaryExpression
        | typeof UnaryExpression
        | ++ PostfixExpression
        | -- PostfixExpression
        | + UnaryExpression
        | - UnaryExpression
(etc)

So ++++a is ruled out at syntax level, and -++a is legal while ++-a isn't.
This matches (part of) behaviour of current implementations.

But is ++a++ going to become legal?

In IE ++a++ etc are reported as runtime errors.
Seamonkey code goes directly to MemberExpression after matching ++/--,
is this the intention? If so, why not in spec?

More generally, is there a reason for deferring to runtime
if it is knowable at parse time that a construct is anyway going to be an error?
(I'm thinking of detail issues like the above, but have no particular
examples at hand where seamonkey defers to runtime)

Thanks,

        re

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Question about spec

Brendan Eich-2
On Aug 22, 2007, at 2:17 PM, rasmus ekman wrote:

Just an arbitrary newbie question...
I note that the updated UnaryExpression BNF 
codifies part of the behaviour of ES-262 implementations:

UnaryExpression ->
PostfixExpression
| delete PostfixExpression
| void UnaryExpression
| typeof UnaryExpression
| ++ PostfixExpression
| -- PostfixExpression
| + UnaryExpression
| - UnaryExpression
(etc)

So ++++a is ruled out at syntax level, and -++a is legal while ++-a isn't.
This matches (part of) behaviour of current implementations.

But is ++a++ going to become legal?

Never, provided ++a cannot result in a magic native object of some kind (which could be an lvalue). See ECMA-262 Edition 3, Chapter 16:

An implementation may treat any instance of the following kinds of runtime errors as a syntax error and therefore report it early:
• Improper uses of return, break, and continue.
• Using the eval property other than via a direct call.
• Errors in regular expression literals.
• Attempts to call PutValue on a value that is not a reference (for example, executing the assignment statement 3=4).
An implementation shall not report other kinds of runtime errors early even if the compiler can prove that a construct cannot execute without error under any circumstances. An implementation may issue an early warning in such a case, but it should not report the error until the relevant construct is actually executed.

In IE ++a++ etc are reported as runtime errors.

It's allowed to, per the above chapter and verse.

Seamonkey

(SpiderMonkey)

code goes directly to MemberExpression after matching ++/--,
is this the intention? If so, why not in spec?

The spec intentionally under-specifies to allow for different implementation strategies.

IMHO, the ES1-3 specs do this too much, and we are trying to improve the situation for ES4. Note however that C, Scheme, and lots of other languages under-specify even more aggressively. JS is different, because interoperation across browsers and other "JS engines" is more the rule than for other languages, which may cluster in source form in silos where only one compiler is used. For fun, read through Dawson Engler's http://www.stanford.edu/~engler/spin05-coverity.pdf some time.

/be

_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Some bugs of Spec.

Eric Suen-4
In reply to this post by Jeff Dyer
23-Jul-2007: Require Block body in LetStatement

according: http://bugs.ecmascript.org/ticket/85

ExpressionStatement ::=
 [lookahead !{ function, let, { }] ListExpression[allowColon,allowIn]

Isn't that enough to tell "let (x = 10);" is LetStatement not
ExpressionStatement with LetExpression?

YieldExpression ::= yield
 | yield AssignmentExpression

because yield is ContextuallyReservedIdentifier, so:

 var yield;
 yield;

is this yield a Identifier or YieldExpression?

 if (yield) {
 }

is this yield a Identifier or YieldExpression?

unit not in ReservedIdentifier or ContextuallyReservedIdentifier

FunctionDeclaration ::= function FunctionName FunctionSignature

should be

FunctionDeclaration[w] ::=
  function FunctionName FunctionSignature Semicolon[w]

AnnotatableDirective[global,w] ::=
   Attribute[t] AnnotatableDirective[global,w]
 | PackageDefinition
 | ...

PackageDefinition ::=
 PackageAttributes 'package' PackageNameOpt PackageBody

Attribute[t] conflict with PackageAttributes

NamespaceAttribute ::= public
 | Identifier
 | Path . Identifier
 | ...

Isn't Path already including them all?

Path ::= Identifier
 | Path . Identifier

Is there any plan when the Spec. will be form?

Regards,

Eric


On 8/22/07, Jeff Dyer <[hidden email]> wrote:

> Hi,
>
> Updated grammar posted at (new location):
>
>     http://www.ecmascript.org/es4/spec/grammar.pdf
>
> Thanks again for the bug reports.
>
> Also, we have no plans to write an LR(1) grammar for ES4. I'm not even sure
> it is possible. Are you volunteering? :)
>
> Jd
>
>
>
>
>
> On 8/21/07 10:52 AM, Eric Suen wrote:
>
> > Some typo:
> >
> > TypeParametersList ::= Identifier
> >  | Identifier , TypeParameterList
> >
> > TypeParametersList should be TypeParameterList
> >
> > BitwiseAndExpression[a,b] ::= EqualityExpression[a,b]
> >  | BitwiseAndExpressionr[a,b] & EqualityExpression[a,b]
> >
> > BitwiseAndExpressionr should be BitwiseAndExpression
> >
> > InitaliserList ::= Initialiser
> >  | InitialiserList ',' Initialiser
> >
> > InitaliserList should be InitialiserList
> >
> > Regards
> >
> > Eric
> >
> > ------------------------------------------------
> > Spket IDE - Development Tool for RIA.
> >
> > http://www.spket.com
> > _______________________________________________
> > Es4-discuss mailing list
> > [hidden email]
> > https://mail.mozilla.org/listinfo/es4-discuss
>
>


--
------------------------------------------------
Spket IDE - Development Tool for RIA.

http://www.spket.com
_______________________________________________
Es4-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es4-discuss