Though it's a little too long since this discussion, I've tried Allen's
idea in my parser and still find conflicting.

Consider the following rules:

PropertyAssignment :
    IdentifierName PropertyName ( ) { FunctionBody }

PropertyAssignment :
    PropertyName : AssignmentExpression

PropertyName :
    IdentifierName

when a parser get “IdentifierName” it need to decide reduce
the IdentifierName into "get" or “PropertyName”. For LR parsers there is no
way to do these things.

I would suggest another way:

IdentifierName ::
    FutureReservedWord
    Keywords
    Identifier
    SpecialWord

SpecialWord ::
    get
    set

2012/5/3 Allen Wirfs-Brock <al...@wirfs-brock.com>

> If I was going to move something to the syntactic grammar it would
> probably be the current definition of Identifier
>
> Identifier :
>     IdentifierName but not ReservedWord
>
> You might  then lex all IdentifierNames (including ReservedWord) as
> IdentifierName tokens and treat all occurrences of keyword terminals in the
> syntactic grammar as short-hands for saying: IdentifierName matching this
> specific keyword.  For example:
>
> PropertyAssignment :
>    get PropertyName ( ) { FunctionBody }
>
> could be interpreted as:
>
> PropertyAssignment :
>    IdentifierName PropertyName ( ) { FunctionBody }
>
> with the static semantic restriction that the text of IdentifierName must
> be "get"
>
>
> Allen
>
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to