I need help translating this portion of the ECMAScript grammar?

Posted by ChaosPandion on Stack Overflow See other posts from Stack Overflow or by ChaosPandion
Published on 2010-05-19T02:22:41Z Indexed on 2010/05/19 14:50 UTC
Read the original article Hit count: 265

Filed under:
|
|

I've been working on my own implementation of ECMAScript for quite some time now. I have basically done everything by hand to help gain a deep understanding of the process. Repeated attempts to analyze and understand this portion of the grammar have failed so I've been working on the run time instead. Now I am at a point were I will be working on object literals so I really need to polish my syntactic analyzer. Can anyone put this in terms a language parser novice could understand?

My biggest source of confusion is the following:

new MemberExpression Arguments

This is supposed to be a member expression, but this seemingly conflicts with the following:

NewExpression :
    MemberExpression 
    new NewExpression

Is a new expression a member expression or a left hand side expression? To be honest I am having trouble laying out the proper C# classes for the concrete grammar.

MemberExpression : 
    PrimaryExpression 
    FunctionExpression 
    MemberExpression [ Expression ] 
    MemberExpression . IdentifierName 
    new MemberExpression Arguments 

NewExpression :
    MemberExpression 
    new NewExpression 

CallExpression :
    MemberExpression Arguments 
    CallExpression Arguments 
    CallExpression [ Expression ] 
    CallExpression . IdentifierName 

LeftHandSideExpression :
    NewExpression 
    CallExpression 

© Stack Overflow or respective owner

Related posts about ecmascript

Related posts about grammar