Understanding static semantics

Allen Wirfs-Brock allen at wirfs-brock.com
Fri Mar 6 15:59:52 UTC 2015


On Mar 6, 2015, at 3:46 AM, raul mihaila wrote:

> Do sentences like "it's a syntax error if the LexicallyDeclaredNames of StatementList contains any duplicate entries" (section 15.1.1) refer to the result of applying the LexicallyDeclaredNames rule for a production alternative in which StatementList is the left-hand side nonterminal? If this is correct, then looking at LexicallyDeclaredNames for StatementList at some point we get to apply LexicallyDeclaredNames for Statement: "1. If Statement is Statement : LabelledStatement , return LexicallyDeclaredNames of Statement." (section 13.1.5). But I couldn't find a definition for LexicallyDeclaredNames where Statement is the lhs nonterminal. So in section 13.1.5 shouldn't it say "If Statement is Statement : LabelledStatement , return LexicallyDeclaredNames of LabelledStatement"?
> 
> Thank you.

On of the Statement productions is Statement  : LabelledStatement

15.3 defines a chain rule for associating algorithms with productions: 

Unless explicitly specified otherwise, all chain productions have an implicit definition for every algorithm that might be applied to that production’s left-hand side nonterminal. The implicit definition simply reapplies the same algorithm name with the same parameters, if any, to the chain production’s sole right-hand side nonterminal and then returns the result.

So, LexicallyDeclaredNames for Statement is in this in this case actually equivalent to LexicallyDeclaredNames for LabelledStatement.

However, it would probably be clearer for step 1 to just say LabelledStatement instead of Statement.

BTW, the best place to raise issues like this is: bugs.ecmascript.org

Allen


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150306/94b83375/attachment-0001.html>


More information about the es-discuss mailing list