RPA Toolkit
work on RJS object introspection.
[rpatk.git] / rjs / ecma262.rpa
1 #!emitall
2 #!emitnone
3
4
5 #!emit DoKeyword
6 #!emit FunctionCallName
7 #!emit IterationDo
8 #!emit LogicalNotExpressionOp
9 #!emit PostfixExpressionOp
10 #!emit PrefixExpressionOp
11 #!emit dqstring
12 #!emit sqstring
13
14 #!emitid SyntaxError                                    UID_SYNTAXERROR                                         1
15 #!emitid AdditiveOperator                               UID_BINARYOPERATOR                                      2
16 #!emitid AdditiveOperator                               UID_ADDITIVEOPERATOR                            2
17 #!emitid MultiplicativeOperator                 UID_MULTIPLICATIVEOPERATOR                      2
18 #!emitid AssignmentOperator                             UID_ASSIGNMENTOPERATOR                          2
19 #!emitid BitwiseANDOperator                             UID_BITWISEANDOPERATOR                          2
20 #!emitid BitwiseNotExpressionOp                 UID_BITWISENOTEXPRESSIONOP                      2
21 #!emitid BitwiseNotOperator                             UID_BITWISENOTOPERATOR                          2
22 #!emitid BitwiseOROperator                              UID_BITWISEOROPERATOR                           2
23 #!emitid BitwiseXOROperator                             UID_BITWISEXOROPERATOR                          2
24 #!emitid LogicalNotOperator                             UID_LOGICALNOTOPERATOR                          2
25 #!emitid LogicalOROperator                              UID_LOGICALOROPERATOR                           2
26 #!emitid LogicalANDOperator                             UID_LOGICALANDOPERATOR                          2
27 #!emitid RelationalOperator                             UID_RELATIONALOPERATOR                          2
28 #!emitid PostfixOperator                                UID_POSTFIXOPERATOR                                     2
29 #!emitid PrefixOperator                                 UID_PREFIXOPERATOR                                      2
30 #!emitid ShiftOperator                                  UID_SHIFTOPERATOR                                       2
31 #!emitid EqualityOperator                               UID_EQUALITYOPERATOR                            2
32 #!emitid UnaryOperator                                  UID_UNARYOPERATOR                                       3
33 #!emitid This                                                   UID_THIS                                                        4
34 #!emitid Expression                                             UID_EXPRESSION                                          5
35 #!emitid LeftHandSideExpression                 UID_LEFTHANDSIDEEXPRESSION                      6
36 #!emitid LeftHandSideExpressionAddr             UID_LEFTHANDSIDEEXPRESSIONADDR          7
37 #!emitid AdditiveExpressionOp                   UID_ADDITIVEEXPRESSIONOP                        8
38 #!emitid MultiplicativeExpressionOp             UID_MULTIPLICATIVEEXPRESSIONOP          9
39 #!emitid BitwiseANDOp                                   UID_BITWISEANDOP                                        10
40 #!emitid BitwiseXOROp                                   UID_BITWISEXOROP                                        11
41 #!emitid BitwiseOROp                                    UID_BITWISEOROP                                         12
42 #!emitid ShiftExpressionOp                              UID_SHIFTEXPRESSIONOP                           13
43 #!emitid EqualityExpressionOp                   UID_EQUALITYEXPRESSIONOP                        14
44 #!emitid RelationalExpressionOp                 UID_RELATIONALEXPRESSIONOP                      15
45 #!emitid LogicalOROp                                    UID_LOGICALOROP                                         16
46 #!emitid LogicalANDOp                                   UID_LOGICALANDOP                                        17
47 #!emitid VariableAllocate                               UID_VARIABLEALLOCATE                            18
48 #!emitid VariableAllocateAndInit                UID_VARIABLEALLOCATEANDINIT                     19
49 #!emitid IdentifierName                                 UID_IDENTIFIERNAME                                      20
50 #!emitid Identifier                                             UID_IDENTIFIER                                          21
51 #!emitid Initialiser                                    UID_INITIALISER                                         22
52 #!emitid AssignmentExpressionOp                 UID_ASSIGNMENTEXPRESSIONOP                      23
53 #!emitid NewArrayExpression                             UID_NEWARRAYEXPRESSION                          24
54 #!emitid MemberExpressionDotOp                  UID_MEMBEREXPRESSIONDOTOP                       25
55 #!emitid MemberExpressionIndexOp                UID_MEMBEREXPRESSIONINDEXOP                     26
56 #!emitid FunctionName                                   UID_FUNCTIONNAME                                        27
57 #!emitid FunctionDeclaration                    UID_FUNCTIONDECLARATION                         28
58 #!emitid FunctionParameter                              UID_FUNCTIONPARAMETER                           29
59 #!emitid FormalParameterList                    UID_FORMALPARAMETERLIST                         30
60 #!emitid CallExpression                                 UID_CALLEXPRESSION                                      31
61 #!emitid FunctionCall                                   UID_FUNCTIONCALL                                        32
62 #!emitid Argument                                               UID_ARGUMENT                                            33
63 #!emitid Arguments                                              UID_ARGUMENTS                                           34
64 #!emitid ReturnStatement                                UID_RETURNSTATEMENT                                     35
65 #!emitid DoubleStringCharacters                 UID_STRINGCHARACTERS                            36
66 #!emitid SingleStringCharacters                 UID_STRINGCHARACTERS                            36
67 #!emitid IfStatement                                    UID_IFSTATEMENT                                         37
68 #!emitid IfConditionOp                                  UID_IFCONDITIONOP                                       38
69 #!emitid IfTrueStatement                                UID_IFTRUESTATEMENT                                     39
70 #!emitid IfFalseStatement                               UID_IFFALSESTATEMENT                            40
71 #!emitid Block                                                  UID_BLOCK                                                       41
72 #!emitid IterationFor                                   UID_ITERATIONFOR                                        42
73 #!emitid ForExpressionInit                              UID_FOREXPRESSIONINIT                           43
74 #!emitid ForExpressionCompare                   UID_FOREXPRESSIONCOMPARE                        44
75 #!emitid ForExpressionIncrement                 UID_FOREXPRESSIONINCREMENT                      45
76 #!emitid ForIterationStatement                  UID_FORITERATIONSTATEMENT                       46
77 #!emitid PostfixExpressionOp                    UID_POSTFIXEXPRESSIONOP                         47
78 #!emitid PrefixExpressionOp                             UID_PREFIXEXPRESSIONOP                          48
79 #!emitid NewExpressionCall                              UID_NEWEXPRESSIONCALL                           49
80 #!emitid FunctionExpression                             UID_FUNCTIONEXPRESSION                          50
81 #!emitid UnaryExpressionOp                              UID_UNARYEXPRESSIONOP                           51
82 #!emitid DecimalIntegerLiteral                  UID_DECIMALINTEGERLITERAL                       52
83 #!emitid DecimalNonIntegerLiteral               UID_DECIMALNONINTEGERLITERAL            53
84 #!emitid BreakStatement                                 UID_BREAKSTATEMENT                                      54
85 #!emitid ContinueStatement                              UID_CONTINUESTATEMENT                           55
86 #!emitid IterationWhile                                 UID_ITERATIONWHILE                                      56
87 #!emitid IterationDo                                    UID_ITERATIONDO                                         57
88 #!emitid WhileExpressionCompare                 UID_WHILEEXPRESSIONCOMPARE                      58
89 #!emitid DoWhileExpressionCompare               UID_DOWHILEEXPRESSIONCOMPARE            59
90 #!emitid Program                                                UID_PROGRAM                                             60
91 #!emitid StringLiteral                                  UID_STRINGLITERAL                                       61
92 #!emitid UnaryExpressionDelete                  UID_UNARYEXPRESSIONDELETE                       62
93 #!emitid IterationForIn                                 UID_ITERATIONFORIN                                      63
94 #!emitid ForInInit                                              UID_FORININIT                                           64
95
96 #!abort SC
97
98
99 # 6 Source Text
100 SourceCharacter                 ::= .
101
102 # 7.2 White space
103 WhiteSpace                              ::= [#0x0009] | [#0x000B] | [#0x000C] | [#0x0020] | [#0x00A0] | [#0xFEFF]
104
105 # 7.3 Line Terminators
106 LineTerminator                  ::= [#0x000D] [#0x000A] | ([#0x000A] | [#0x000D] | [#0x2028] | [#0x2029])
107 LineTerminatorSequence  ::= [#0x000D] [#0x000A] | [#0x000A] | [#0x000D] | [#0x2028] | [#0x2029]
108 S                                               ::= ( <WhiteSpace> | <LineTerminator> )+
109 SC                                              ::= <S>? ';' <S>?
110 COMMA                                   ::= <S>? ',' <S>?
111 EQ                                              ::= <S>? '=' <S>?
112
113 # 7.4 Comments
114 Comment                                 ::= <MultiLineComment> | <SingleLineComment>
115 MultiLineComment                ::= '/*' <MultiLineCommentChar>* '*/'
116 MultiLineCommentChar    ::= . - '*/'
117 SingleLineComment               ::= '#' <SingleLineCommentChar>*
118 SingleLineCommentChar   ::= <SourceCharacter> - <LineTerminator>
119
120 # 7.5 Tokens
121 Token                                   ::= <IdentifierName> |
122                                                 <NumericLiteral> |
123                                                 <StringLiteral>
124
125 # 7.6 Identifier Names and Identifiers
126
127 Identifier                              ::= <IdentifierNameNoEmit> - (<ReservedWord> - <ReservedWord> <IdentifierPart>)
128 IdentifierNoEmit                ::= <IdentifierNameNoEmit> - (<ReservedWord> - <ReservedWord> <IdentifierPart>)
129 IdentifierName                  ::= <IdentifierStart> <IdentifierPart>*
130 IdentifierNameNoEmit    ::= <IdentifierStart> <IdentifierPart>*
131 IdentifierStart                 ::= <UnicodeLetter> | '$' | '_' | '\' <UnicodeLetter>
132 UnicodeLetter                   ::= [#0x0041-#0x005A] | [#0x00C0-#0x00DE] | [#0x0100-#0x0232] | [#0x0061-#0x007A] | [#0x00C0-#0x00DE]       # <Lu> | <Ll>
133
134 Lu                                              ::= [#0x0041-#0x005A] | [#0x00C0-#0x00DE] | [#0x0100-#0x0232]   # TBD
135 Ll                                              ::= [#0x0061-#0x007A] | [#0x00C0-#0x00DE]                                               # TBD
136 IdentifierPart                  ::= <IdentifierStart> | 
137                                                 <UnicodeDigit> 
138 UnicodeDigit                    ::= [0-9] | [#0x0660-#0x0669]                                   # TBD
139
140 ReservedWord                    ::= <NullLiteral> |
141                                                         <BooleanLiteral> |
142                                                         <Keyword> |
143                                                         <FutureReservedWord>
144
145 Keyword                                 ::= 'instanceof' | 'typeof'     | 'break' |
146                                                 'do' | 'new' | 'var' |
147                                                 'case' | 'else' | 'return' | 'void' | 
148                                                 'catch' | 'finally' | 'continue' | 'for' | 
149                                                 'switch' | 'while' | 'this' | 'with' | 
150                                                 'debugger' | 'function' | 'throw' | 'default' |  
151                                                 'if' | 'try' | 'delete' | 'in'
152
153 FutureReservedWord                      ::= 'class' | 'enum' | 'extends' | 'import' | 'const' | 'export' |
154                                                         'implements' | 'let' | 'private' | 'public' |
155                                 'static' | 'interface' | 'package' | 'protected'
156
157 NullLiteral                                     ::= 'null'
158 BooleanLiteral                          ::= 'true' | 'false'
159 Literal                                         ::= <NullLiteral> |
160                                                         <BooleanLiteral> |
161                                                         <NumericLiteral> |
162                                                         <StringLiteral>
163                                                         
164 LiteralOp                                       ::= <Literal>
165
166 # 7.8.3 Numeric Literals
167
168 NumericLiteral                                  ::= <HexIntegerLiteral> | <DecimalNonIntegerLiteral> | <DecimalIntegerLiteral>
169 DecimalNonIntegerLiteral                ::= ('0' | <NonZeroDigit> <DecimalDigits>?) '.' <DecimalDigits>? <ExponentPart>? |
170                                                                 '.' <DecimalDigits> <ExponentPart>? 
171 DecimalIntegerLiteral                   ::= '0' | <NonZeroDigit> <DecimalDigits>? <ExponentPart>?
172 DecimalDigits                                   ::= <DecimalDigit>+
173 DecimalDigit                                    ::= [0-9]
174 NonZeroDigit                                    ::= [1-9]
175 ExponentPart                                    ::= <ExponentIndicator> <SignedInteger>
176 ExponentIndicator                               ::= [eE]
177 SignedInteger                                   ::= '-' <DecimalDigits> |
178                                                                 '+' <DecimalDigits> |
179                                                                 <DecimalDigits>
180 HexIntegerLiteral                               ::= '0' [xX] <HexDigit>+
181 HexDigit                                                ::= [0-9a-fA-F]
182
183 # 7.8.4 String Literals
184 StringLiteral                                   ::= '"' <DoubleStringCharacters>? '"' |
185                                                                 "'" <SingleStringCharacters>? "'"
186
187 DoubleStringCharacters                  ::= <DoubleStringCharacter>+
188 SingleStringCharacters                  ::= <SingleStringCharacter>+
189
190 DoubleStringCharacter                   ::= <SourceCharacter> - ('"' | '\\' | <LineTerminator>)
191
192 SingleStringCharacter                   ::= <SourceCharacter> - ("'" | '\\' | <LineTerminator>)
193 This                                                    ::= 'this'
194
195 PrimaryExpression                               ::= <This> | 
196                                                                 '(' <S>? <Expression> <S>? ')' |
197                                                                 <Literal> |
198                                                                 <Identifier>
199
200
201
202
203 ArrayLiteral                                    ::= '[' <S>? <Elision>? <S>? ']' |
204                                                                 '[' <S>? <ElementList> <S>? ']' |
205                                                                 '[' <S>? <ElementList> <S>? ',' <S>? <Elision> <S>? ']'
206 ElementList                                             ::= <Elision>? <S>? <AssignmentExpression> (<S>? ',' <S>? <Elision>? <S>? <AssignmentExpression> )*
207 Elision                                                 ::= ',' <S>? <Elision> | <S>? ','
208
209
210 # 11.2 Left-Hand-Side Expressions
211 LSB                                                             ::= <S>? '[' <S>?
212 RSB                                                             ::= <S>? ']' <S>?
213 MemberExpressionBase                    ::= <MemberExpression>
214 MemberExpressionIndexOp                 ::= <MemberExpressionBase> <LSB> <Expression> <RSB>
215 MemberExpressionDotOp                   ::= <MemberExpressionBase> '.' <IdentifierName>
216
217 MemberExpression                                ::= <MemberExpressionIndexOp>  |
218                                                                         <MemberExpressionDotOp> |
219                                                                         <FunctionExpression> |
220                                                                         <PrimaryExpression>
221                                                                         
222 NewKeyword                                              ::= 'new' - 'new' <IdentifierPart>
223 NewExpressionCall                               ::= <NewKeyword> <S>? <MemberExpression> <S>? <Arguments>?
224
225 NewExpression                                   ::= <NewExpressionCall> |
226                                                                         <MemberExpression>
227
228 # NewExpression                                         ::= <NewKeyword> <S>? <NewExpression> |
229 #                                                                       <MemberExpression>
230
231
232 FunctionCallName                                ::= <CallExpression> | <MemberExpression>
233 FunctionCall                                    ::= <FunctionCallName> <S>? <Arguments>
234 CallExpression                                  ::= <CallExpression> <S>? '[' <S>? Expression <S>? ']' |
235                                                                         <CallExpression> '.' <IdentifierName> |
236                                                                         <FunctionCall>
237
238 Arguments                                               ::= '(' <S>? ')' |
239                                                                 '(' <S>? <ArgumentList> <S>? ')'
240 Argument                                                ::= <AssignmentExpression>
241 ArgumentList                                    ::= <ArgumentList> <S>? ',' <S>? <Argument> |
242                                                                         <Argument>
243 LeftHandSideExpression                  ::= <CallExpression> | <NewExpression>
244 LeftHandSideExpressionAddr              ::= <CallExpression> | <NewExpression>
245
246
247 # 11.3 Postfix Expressions
248 # RULE: LeftHandSideExpression always ends up in R0 (Let see if this would work)
249 PostfixOperator                                 ::= '++' | '--'
250 PostfixExpressionOp                     ::= <LeftHandSideExpressionAddr> <PostfixOperator>
251 PostfixExpression                               ::= <PostfixExpressionOp> | <LeftHandSideExpression> 
252
253 PrefixOperator                                  ::= '++' | '--'
254 PrefixExpressionOp                              ::= <PrefixOperator> <LeftHandSideExpressionAddr>
255 PrefixExpression                                ::= <PrefixExpressionOp> | <PostfixExpression>
256
257 # 11.4 Unary Operators
258 UnaryOperator                                   ::= '~' | '!' | ('+' - '++') | ('-' - '--') | 'void' | 'typeof'
259 UnaryExpressionOp                       ::=     <S>? <UnaryOperator> <S>? <UnaryExpression>
260 UnaryExpressionDelete                   ::=     <S>? 'delete' <S>? <UnaryExpression>
261 UnaryExpressionVoid                             ::=     <S>? 'void' <S>? <UnaryExpression>
262 UnaryExpressionTypeof                   ::=     <S>? 'typeof' <S>? <UnaryExpression>
263 UnaryExpression                         ::=     <UnaryExpressionOp> | <UnaryExpressionDelete> | <UnaryExpressionTypeof> |<UnaryExpressionVoid> | <PrefixExpression>
264
265
266 # 11.5 Multiplicative Operators
267 MultiplicativeOperator                  ::= '*' | '/' | '%'
268 MultiplicativeExpressionOp              ::= <MultiplicativeExpression> <S>? <MultiplicativeOperator> <S>? <UnaryExpression>
269 MultiplicativeExpression                ::= <MultiplicativeExpressionOp> | 
270                                                                         <UnaryExpression>
271
272 # 11.6 Additive Operators
273 AdditiveOperator                                ::= '+' | '-'
274 # AbortIfNotMultiplicativeExpression    ::= <MultiplicativeExpression>
275 AdditiveExpressionOp                    ::= <AdditiveExpression> <S>? <AdditiveOperator> <S>? <MultiplicativeExpression>
276 AdditiveExpression                              ::= <AdditiveExpressionOp> | 
277                                                                         <MultiplicativeExpression>
278
279
280 11.7 Bitwise Shift Operators
281 ShiftOperator                                   ::= '>>>' | '<<' | '>>'
282 ShiftExpressionOp                               ::= <ShiftExpression> <S>? <ShiftOperator> <S>? <AdditiveExpression>
283 ShiftExpression                                 ::= <ShiftExpressionOp> |
284                                                                 <AdditiveExpression> 
285
286
287 # 11.8 Relational Operators
288 RelationalOperator                              ::= '<=' | '>=' | '<' | '>' | 'instanceof'
289 RelationalExpressionOp                  ::= <RelationalExpression> <S>? <RelationalOperator> <S>? <ShiftExpression>
290 RelationalExpression                    ::= <RelationalExpressionOp> |
291                                                                 <ShiftExpression>
292
293 # 11.9 Equality Operators
294 EqualityOperator                                ::= '===' | '==' | '!==' | '!='
295 EqualityExpressionOp                    ::= <EqualityExpression> <S>? <EqualityOperator> <S>? <RelationalExpression> 
296 EqualityExpression                              ::= <EqualityExpressionOp> |
297                                                                 <RelationalExpression>
298
299 BitwiseANDOperator                              ::= '&' - '&&'
300 BitwiseANDOp                                    ::= <BitwiseANDExpression> <S>? <BitwiseANDOperator> <S>? <EqualityExpression>
301 BitwiseANDExpression                    ::= <BitwiseANDOp> |
302                                                                 <EqualityExpression>
303
304 BitwiseXOROperator                              ::= '^'
305 BitwiseXOROp                                    ::= <BitwiseXORExpression> <S>? <BitwiseXOROperator> <S>? <BitwiseANDExpression>
306 BitwiseXORExpression                    ::= <BitwiseXOROp> |
307                                                                 <BitwiseANDExpression>
308
309 BitwiseOROperator                               ::= '|' - '||'
310 BitwiseOROp                                             ::= <BitwiseORExpression> <S>? <BitwiseOROperator> <S>? <BitwiseXORExpression>
311 BitwiseORExpression                     ::= <BitwiseOROp> |
312                                                                 <BitwiseXORExpression>
313
314 # 11.11 Binary Logical Operators
315 LogicalANDOperator                              ::= '&&'
316 LogicalANDOp                                    ::= <LogicalANDExpression> <S>? <LogicalANDOperator>  <S>? <BitwiseORExpression>
317 LogicalANDExpression                    ::= <LogicalANDOp> |
318                                                                 <BitwiseORExpression>
319
320 LogicalOROperator                               ::= '||'
321 LogicalOROp                                             ::= <LogicalORExpression> <S>? <LogicalOROperator> <S>? <LogicalANDExpression>
322 LogicalORExpression                     ::= <LogicalOROp> |
323                                                                 <LogicalANDExpression>
324
325
326 # 11.12 Conditional Operator ( ? : )
327 ConditionalExpression                   ::= <LogicalORExpression> ( <S>? '?' <S>? <AssignmentExpression> <S>? ':' <S>? <AssignmentExpression> )?
328
329 # 11.13 Assignment Operators
330 AssignmentExpressionOp                  ::= <LeftHandSideExpressionAddr> <S>? <AssignmentOperator> <S>? <AssignmentExpression>
331 AssignmentExpression                    ::= <AssignmentExpressionOp> | <ConditionalExpression>
332 AssignmentOperator                              ::= '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '>>>=' | '&=' | '^=' | '|='
333
334
335 # 11.14 Comma Operator  ( , )
336 Expression                                      ::= <AssignmentExpression> ( <S>? ',' <S>? <AssignmentExpression> )*
337
338
339 # 12 Statements
340 Statement                                               ::= <FunctionDeclarationStatement> |
341                                                                 <ExpressionStatement> |
342                                                                         <ContinueStatement> |
343                                                                         <Block> |
344                                                                 <Comment> |
345                                                                 <VariableStatement> |
346                                                                 <EmptyStatement> |
347                                                                 <IfStatement> |
348                                                                 <IterationStatement> |
349                                                                 <ContinueStatement> |
350                                                                 <BreakStatement> |
351                                                                 <ReturnStatement> |
352                                                                 <WithStatement> |
353                                                                 <SwitchStatementOp>
354
355 # 12.1 Block
356 Block                                                           ::= <S>? '{' <S>? <StatementList>? <S>? '}' <S>?
357 StatementList                                           ::= (<S>? <Statement>)+
358
359 # 12.2 Variable Statement
360 VariableStatement                                       ::= 'var' <S>? <VariableDeclarationList> <SC>
361 VariableDeclarationList                         ::= <VariableDeclaration> (<COMMA> <VariableDeclaration> )*
362 VariableAllocate                                        ::= <IdentifierNoEmit>
363 VariableAllocateAndInit                         ::= <IdentifierNoEmit>
364 VariableAllocatePush                            ::= <IdentifierNoEmit>
365 VariableDeclaration                                     ::= <VariableAllocateAndInit> <Initialiser> | <VariableAllocate>
366 Initialiser                                                     ::= <EQ> <AssignmentExpression>
367
368
369 # 12.3 Empty Statement
370 EmptyStatement                                          ::= <S>? ';' <S>?
371
372 # 12.4 Expression Statement
373 ExpressionStatement                             ::= (<Expression> - ('function' | '{')) <SC>
374
375
376 # 12.5 The if Statement
377 #!abort IfBrackets
378 IfBrackets                                                      ::= '(' <S>? <Expression> <S>? ')'
379 IfConditionOp                                           ::= 'if' <S>? <IfBrackets>
380 IfTrueStatement                                         ::= <Statement>
381 IfFalseStatement                                        ::= <Statement>
382 IfStatement                                                     ::= <IfConditionOp> <S>? <IfTrueStatement> <S>? 'else' <S>? <IfFalseStatement> |
383                                                                         <IfConditionOp> <S>? <IfTrueStatement> 
384
385 # 12.6 Iteration Statements
386 # 12.6a Iteration do ... while() 
387 DoWhileExpressionCompare                        ::= <Expression>
388 IterationDo                                                     ::= 'do' <S>? <Statement> <S>? 'while' <S>? '(' <S>? <DoWhileExpressionCompare> <S>? ')' <SC>
389
390 # 12.6b Iteration while()
391 WhileExpressionCompare                          ::= <Expression>
392 IterationWhile                                          ::= 'while' <S>? '(' <S>? <WhileExpressionCompare> <S>? ')' <S>? <Statement>
393
394 # 12.6c Iteration for ( ; ; )
395 ExpressionNoIn                                          ::= <Expression>
396 ForExpressionInit                                       ::= ('var' <S>? <VariableDeclarationList>) | <ExpressionNoIn>
397 ForExpressionCompare                            ::= <Expression>
398 ForExpressionIncrement                          ::= <Expression>
399 ForIterationStatement                           ::= <Statement>
400 IterationFor                                            ::= 'for' <S>? '(' <S>? <ForExpressionInit>? <S>? ';' <S>? <ForExpressionCompare>? <S>? ';' <S>? <ForExpressionIncrement>? <S>? ')' <S>? <ForIterationStatement>
401
402 # 12.6d Iteration for ( in )
403 ForInIterator                                           ::= ('var' <S>? <VariableAllocateAndInit>) | <LeftHandSideExpressionAddr>
404 ForInInit                                                       ::= <ForInIterator> <S>? 'in' <S>? <Expression>
405 IterationForIn                                          ::= 'for' <S>? '(' <S>? <ForInInit> <S>? ')' <S>?  <Statement>
406
407 IterationStatement                                      ::= <IterationWhile> |
408                                                                                 <IterationFor> |
409                                                                                 <IterationForIn> |
410                                                                         <IterationDo>
411
412 # 12.9 The return Statement
413 ReturnOp                                                        ::= ('return' - 'return' <IdentifierPart>) <WhiteSpace>* <AssignmentExpression>? <SC>
414 ReturnStatement                                         ::= ('return' - 'return' <IdentifierPart>) <WhiteSpace>* <AssignmentExpression>? <SC>
415
416 # The Break Statement
417 BreakOp                                                         ::= 'break' - 'break' <IdentifierPart>
418 BreakStatement                                          ::= <S>? <BreakOp> <SC>
419
420 # The Continue Statement
421 ContinueOp                                                      ::= 'continue' - 'continue' <IdentifierPart>
422 ContinueStatement                                       ::= <S>? <ContinueOp> <SC>
423
424
425
426 # 12.10 The with Statement
427 WithStatement                                           ::= 'with' <S>? '(' <S>? <Expression> <S>? ')' <S>? <Statement>
428
429
430 # 12.11 The switch Statement
431 SwitchExpressionOp                                      ::= ('switch' - 'switch' <IdentifierPart>) <S>? '(' <S>? <Expression> <S>? ')'
432 SwitchStatementOp                                       ::= <SwitchExpressionOp> <S>? <CaseBlock>
433
434 CaseBlock                                                       ::= '{' <S>? <CaseClauses>? <S>? <DefaultClauseOp>? <S>? <CaseClauses>? <S>? '}' |
435                                                                         '{' <S>? <CaseClauses>? <S>? '}'
436
437
438
439 CaseClauses                                             ::= (<S>? <CaseClauseOp>)+
440 CaseExpressionOp                                        ::= ('case' - 'case' <IdentifierPart>) <S>? <Expression> <S>? ':'
441 CaseClauseOp                                            ::= <CaseExpressionOp> <S>? <StatementList>?
442 DefaultKeywordOp                                        ::= 'default' - 'default' <IdentifierPart>
443 DefaultClauseOp                                         ::= <DefaultKeywordOp> <S>? ':' <S>? <StatementList>?
444
445
446 # 13 Function Definition
447 FunctionName                                            ::= <IdentifierNoEmit>
448 FunctionDeclaration                                     ::= ('function'-'function'<IdentifierPart>)<S>?<FunctionName><S>?'('<S>?<FormalParameterList>?<S>?')'<S>?'{'<S>?<FunctionBody>?<S>?'}'
449 FunctionExpression                                      ::= ('function'-'function'<IdentifierPart>)<S>?<FunctionName>?<S>?'('<S>?<FormalParameterList>?<S>?')'<S>?'{'<S>?<FunctionBody>?<S>?'}'
450 FormalParameterList                             ::= <FunctionParameter> ( <S>? ',' <S>? <FunctionParameter> )*
451 FunctionParameter                                       ::= <IdentifierNoEmit>
452 FunctionBody                                            ::= <SourceElements>
453 FunctionDeclarationStatement            ::= ('function' - 'function' <IdentifierPart>)<S>?<FunctionName><S>?'('<S>?<FormalParameterList>?<S>?')' <SC>
454
455 # FunctionName                                          ::= <IdentifierNoEmit>
456 # FunctionNameLookupAlloc                       ::= <IdentifierNoEmit>
457 # FunctionDefinition                            ::= ('function' - 'function' <IdentifierPart>)<S>?<FunctionName><S>?'('<S>?<FormalParameterList>?<S>?')'
458 # FunctionDeclaration                           ::= <FunctionDefinition><S>?'{'<S>?<FunctionBody>?<S>?'}'
459 # FunctionExpression                            ::= ('function' - 'function'<IdentifierPart>)<S>?<FunctionName>?<S>?'('<S>?<FormalParameterList>?<S>?')'<S>?'{'<S>?<FunctionBody>?<S>?'}'
460 # FunctionParameter                             ::= <Identifier>
461 # FormalParameterList                           ::= <FunctionParameter> ( <S>? ',' <S>? <FunctionParameter> )*
462 # FunctionDefinitionStatement           ::= ('function' - 'function' <IdentifierPart>)<S>?<FunctionNameLookupAlloc><S>?'('<S>?<FormalParameterList>?<S>?')' <SC>
463 # FunctionBody                                          ::= <SourceElements>
464
465
466 # 14 Program
467 SourceElements                                  ::= (<S>? <SourceElement>)+
468 SourceElement                                   ::= <FunctionDeclaration> |
469                                                                 <Statement> 
470 Program                                                 ::= <SourceElements>
471 # The root rule, it is anonymous
472 <Program>
473
474