Hi All:
   I want to understand the javascript grammar from Grammar.y in
JavascriptCore,for the script "var a=9;",we find the following code:
   VariableStatement:
        VAR VariableDeclarationList ';' {...}

   VariableDeclarationList:
        IDENT                           {...}
        | IDENT Initializer             {...}
   Initializer:
    '=' AssignmentExpr                  { $$ = $2; }

   AssignmentExpr:
     ConditionalExpr
     | LeftHandSideExpr AssignmentOperator AssignmentExpr {...}

   in my understand, '9' maybe be as
Literal/PrimaryExprNoBrace/PrimaryExpr/MemberExpr/LeftHandSideExpr etc,but
why can be converted as AssignmentExpr?

   in the script "a=b;", i also encounter the same case, why the 'b' can be
converted as AssignmentExpr?

   the following update can be correct?
   AssignmentExpr:
     ConditionalExpr
     |LeftHandSideExpr
     | LeftHandSideExpr AssignmentOperator AssignmentExpr {...}

   someone can help me understand the grammar?

Thanks and Best Regards

Suk
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to