RPA Toolkit
84a2dbe8a0b5fa6cc8b41207b857a4fc818ed840
[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 FunctionNameAlloc                              UID_FUNCTIONNAMEALLOC                           61
92
93
94 # 6 Source Text
95 SourceCharacter                 ::= .
96
97 # 7.2 White space
98 WhiteSpace                              ::= [#0x0009] | [#0x000B] | [#0x000C] | [#0x0020] | [#0x00A0] | [#0xFEFF]
99
100 # 7.3 Line Terminators
101 LineTerminator                  ::= [#0x000D] [#0x000A] | ([#0x000A] | [#0x000D] | [#0x2028] | [#0x2029])
102 LineTerminatorSequence  ::= [#0x000D] [#0x000A] | [#0x000A] | [#0x000D] | [#0x2028] | [#0x2029]
103 S                                               ::= ( <WhiteSpace> | <LineTerminator> )+
104 SC                                              ::= <S>? ';' <S>?
105 COMMA                                   ::= <S>? ',' <S>?
106 EQ                                              ::= <S>? '=' <S>?
107
108 # 7.4 Comments
109 Comment                                 ::= <MultiLineComment> | <SingleLineComment>
110 MultiLineComment                ::= '/*' <MultiLineCommentChar>* '*/'
111 MultiLineCommentChar    ::= . - '*/'
112 SingleLineComment               ::= '#' <SingleLineCommentChar>*
113 SingleLineCommentChar   ::= <SourceCharacter> - <LineTerminator>
114
115 # 7.5 Tokens
116 Token                                   ::= <IdentifierName> |
117                                                 <NumericLiteral> |
118                                                 <StringLiteral>
119
120 # 7.6 Identifier Names and Identifiers
121
122 Identifier                              ::= <IdentifierNameNoEmit> - (<ReservedWord> - <ReservedWord> <IdentifierPart>)
123 IdentifierNoEmit                ::= <IdentifierNameNoEmit> - (<ReservedWord> - <ReservedWord> <IdentifierPart>)
124 IdentifierName                  ::= <IdentifierStart> <IdentifierPart>*
125 IdentifierNameNoEmit    ::= <IdentifierStart> <IdentifierPart>*
126 IdentifierStart                 ::= <UnicodeLetter> | '$' | '_' | '\' <UnicodeLetter>
127 UnicodeLetter                   ::= [#0x0041-#0x005A] | [#0x00C0-#0x00DE] | [#0x0100-#0x0232] | [#0x0061-#0x007A] | [#0x00C0-#0x00DE]       # <Lu> | <Ll>
128
129 Lu                                              ::= [#0x0041-#0x005A] | [#0x00C0-#0x00DE] | [#0x0100-#0x0232]   # TBD
130 Ll                                              ::= [#0x0061-#0x007A] | [#0x00C0-#0x00DE]                                               # TBD
131 IdentifierPart                  ::= <IdentifierStart> | 
132                                                 <UnicodeDigit> 
133 UnicodeDigit                    ::= [0-9] | [#0x0660-#0x0669]                                   # TBD
134
135 ReservedWord                    ::= <NullLiteral> |
136                                                         <BooleanLiteral> |
137                                                         <Keyword> |
138                                                         <FutureReservedWord>
139
140 Keyword                                 ::= 'instanceof' | 'typeof'     | 'break' |
141                                                 'do' | 'new' | 'var' |
142                                                 'case' | 'else' | 'return' | 'void' | 
143                                                 'catch' | 'finally' | 'continue' | 'for' | 
144                                                 'switch' | 'while' | 'this' | 'with' | 
145                                                 'debugger' | 'function' | 'throw' | 'default' |  
146                                                 'if' | 'try' | 'delete' | 'in'
147
148 FutureReservedWord                      ::= 'class' | 'enum' | 'extends' | 'import' | 'const' | 'export' |
149                                                         'implements' | 'let' | 'private' | 'public' |
150                                 'static' | 'interface' | 'package' | 'protected'
151
152 NullLiteral                                     ::= 'null'
153 BooleanLiteral                          ::= 'true' | 'false'
154 Literal                                         ::= <NullLiteral> |
155                                                         <BooleanLiteral> |
156                                                         <NumericLiteral> |
157                                                         <StringLiteral>
158                                                         
159 LiteralOp                                       ::= <Literal>
160
161 # 7.8.3 Numeric Literals
162
163 NumericLiteral                                  ::= <HexIntegerLiteral> | <DecimalNonIntegerLiteral> | <DecimalIntegerLiteral>
164 DecimalNonIntegerLiteral                ::= ('0' | <NonZeroDigit> <DecimalDigits>?) '.' <DecimalDigits>? <ExponentPart>? |
165                                                                 '.' <DecimalDigits> <ExponentPart>? 
166 DecimalIntegerLiteral                   ::= '0' | <NonZeroDigit> <DecimalDigits>? <ExponentPart>?
167 DecimalDigits                                   ::= <DecimalDigit>+
168 DecimalDigit                                    ::= [0-9]
169 NonZeroDigit                                    ::= [1-9]
170 ExponentPart                                    ::= <ExponentIndicator> <SignedInteger>
171 ExponentIndicator                               ::= [eE]
172 SignedInteger                                   ::= '-' <DecimalDigits> |
173                                                                 '+' <DecimalDigits> |
174                                                                 <DecimalDigits>
175 HexIntegerLiteral                               ::= '0' [xX] <HexDigit>+
176 HexDigit                                                ::= [0-9a-fA-F]
177
178 # 7.8.4 String Literals
179 StringLiteral                                   ::= '"' <DoubleStringCharacters>? '"' |
180                                                                 "'" <SingleStringCharacters>? "'"
181
182 DoubleStringCharacters                  ::= <DoubleStringCharacter>+
183 SingleStringCharacters                  ::= <SingleStringCharacter>+
184
185 DoubleStringCharacter                   ::= <SourceCharacter> - ('"' | '\\' | <LineTerminator>)
186
187 SingleStringCharacter                   ::= <SourceCharacter> - ("'" | '\\' | <LineTerminator>)
188 This                                                    ::= 'this'
189
190 PrimaryExpression                               ::= <This> | 
191                                                                 '(' <S>? <Expression> <S>? ')' |
192                                                                 <Literal> |
193                                                                 <Identifier>
194
195
196
197
198 ArrayLiteral                                    ::= '[' <S>? <Elision>? <S>? ']' |
199                                                                 '[' <S>? <ElementList> <S>? ']' |
200                                                                 '[' <S>? <ElementList> <S>? ',' <S>? <Elision> <S>? ']'
201 ElementList                                             ::= <Elision>? <S>? <AssignmentExpression> (<S>? ',' <S>? <Elision>? <S>? <AssignmentExpression> )*
202 Elision                                                 ::= ',' <S>? <Elision> | <S>? ','
203
204
205 # 11.2 Left-Hand-Side Expressions
206 LSB                                                             ::= <S>? '[' <S>?
207 RSB                                                             ::= <S>? ']' <S>?
208 MemberExpressionBase                    ::= <MemberExpression>
209 MemberExpressionIndexOp                 ::= <MemberExpressionBase> <LSB> <Expression> <RSB>
210 MemberExpressionDotOp                   ::= <MemberExpressionBase> '.' <IdentifierName>
211
212 MemberExpression                                ::= <MemberExpressionIndexOp>  |
213                                                                         <MemberExpressionDotOp> |
214                                                                         <FunctionExpression> |
215                                                                         <PrimaryExpression>
216                                                                         
217 NewKeyword                                              ::= 'new' - 'new' <IdentifierPart>
218 NewExpressionCall                               ::= <NewKeyword> <S>? <MemberExpression> <S>? <Arguments>?
219
220 NewExpression                                   ::= <NewExpressionCall> |
221                                                                         <MemberExpression>
222
223 # NewExpression                                         ::= <NewKeyword> <S>? <NewExpression> |
224 #                                                                       <MemberExpression>
225
226
227 FunctionCallName                                ::= <CallExpression> | <MemberExpression>
228 FunctionCall                                    ::= <FunctionCallName> <S>? <Arguments>
229 CallExpression                                  ::= <CallExpression> <S>? '[' <S>? Expression <S>? ']' |
230                                                                         <CallExpression> '.' <IdentifierName> |
231                                                                         <FunctionCall>
232
233 Arguments                                               ::= '(' <S>? ')' |
234                                                                 '(' <S>? <ArgumentList> <S>? ')'
235 Argument                                                ::= <AssignmentExpression>
236 ArgumentList                                    ::= <ArgumentList> <S>? ',' <S>? <Argument> |
237                                                                         <Argument>
238 LeftHandSideExpression                  ::= <CallExpression> | <NewExpression>
239 LeftHandSideExpressionAddr              ::= <CallExpression> | <NewExpression>
240
241
242 # 11.3 Postfix Expressions
243 # RULE: LeftHandSideExpression always ends up in R0 (Let see if this would work)
244 PostfixOperator                                 ::= '++' | '--'
245 PostfixExpressionOp                     ::= <LeftHandSideExpressionAddr> <PostfixOperator>
246 PostfixExpression                               ::= <PostfixExpressionOp> | <LeftHandSideExpression> 
247
248 PrefixOperator                                  ::= '++' | '--'
249 PrefixExpressionOp                              ::= <PrefixOperator> <LeftHandSideExpressionAddr>
250 PrefixExpression                                ::= <PrefixExpressionOp> | <PostfixExpression>
251
252 # 11.4 Unary Operators
253 UnaryOperator                                   ::= '~' | '!' | ('+' - '++') | ('-' - '--') | 'delete' | 'void' | 'typeof'
254 UnaryExpressionOp                       ::=     <S>? <UnaryOperator> <S>? <UnaryExpression>
255 UnaryExpression                         ::=     <UnaryExpressionOp> | <PrefixExpression>
256
257
258 # 11.5 Multiplicative Operators
259 MultiplicativeOperator                  ::= '*' | '/' | '%'
260 MultiplicativeExpressionOp              ::= <MultiplicativeExpression> <S>? <MultiplicativeOperator> <S>? <UnaryExpression>
261 MultiplicativeExpression                ::= <MultiplicativeExpressionOp> | 
262                                                                         <UnaryExpression>
263
264 # 11.6 Additive Operators
265 AdditiveOperator                                ::= '+' | '-'
266 AdditiveExpressionOp                    ::= <AdditiveExpression> <S>? <AdditiveOperator> <S>? <MultiplicativeExpression>
267 AdditiveExpression                              ::= <AdditiveExpressionOp> | 
268                                                                         <MultiplicativeExpression>
269
270
271 11.7 Bitwise Shift Operators
272 ShiftOperator                                   ::= '>>>' | '<<' | '>>'
273 ShiftExpressionOp                               ::= <ShiftExpression> <S>? <ShiftOperator> <S>? <AdditiveExpression>
274 ShiftExpression                                 ::= <ShiftExpressionOp> |
275                                                                 <AdditiveExpression> 
276
277
278 # 11.8 Relational Operators
279 RelationalOperator                              ::= '<=' | '>=' | '<' | '>' | 'instanceof'
280 RelationalExpressionOp                  ::= <RelationalExpression> <S>? <RelationalOperator> <S>? <ShiftExpression>
281 RelationalExpression                    ::= <RelationalExpressionOp> |
282                                                                 <ShiftExpression>
283
284 # 11.9 Equality Operators
285 EqualityOperator                                ::= '===' | '==' | '!==' | '!='
286 EqualityExpressionOp                    ::= <EqualityExpression> <S>? <EqualityOperator> <S>? <RelationalExpression> 
287 EqualityExpression                              ::= <EqualityExpressionOp> |
288                                                                 <RelationalExpression>
289
290 BitwiseANDOperator                              ::= '&' - '&&'
291 BitwiseANDOp                                    ::= <BitwiseANDExpression> <S>? <BitwiseANDOperator> <S>? <EqualityExpression>
292 BitwiseANDExpression                    ::= <BitwiseANDOp> |
293                                                                 <EqualityExpression>
294
295 BitwiseXOROperator                              ::= '^'
296 BitwiseXOROp                                    ::= <BitwiseXORExpression> <S>? <BitwiseXOROperator> <S>? <BitwiseANDExpression>
297 BitwiseXORExpression                    ::= <BitwiseXOROp> |
298                                                                 <BitwiseANDExpression>
299
300 BitwiseOROperator                               ::= '|' - '||'
301 BitwiseOROp                                             ::= <BitwiseORExpression> <S>? <BitwiseOROperator> <S>? <BitwiseXORExpression>
302 BitwiseORExpression                     ::= <BitwiseOROp> |
303                                                                 <BitwiseXORExpression>
304
305 # 11.11 Binary Logical Operators
306 LogicalANDOperator                              ::= '&&'
307 LogicalANDOp                                    ::= <LogicalANDExpression> <S>? <LogicalANDOperator>  <S>? <BitwiseORExpression>
308 LogicalANDExpression                    ::= <LogicalANDOp> |
309                                                                 <BitwiseORExpression>
310
311 LogicalOROperator                               ::= '||'
312 LogicalOROp                                             ::= <LogicalORExpression> <S>? <LogicalOROperator> <S>? <LogicalANDExpression>
313 LogicalORExpression                     ::= <LogicalOROp> |
314                                                                 <LogicalANDExpression>
315
316
317 # 11.12 Conditional Operator ( ? : )
318 ConditionalExpression                   ::= <LogicalORExpression> ( <S>? '?' <S>? <AssignmentExpression> <S>? ':' <S>? <AssignmentExpression> )?
319
320 # 11.13 Assignment Operators
321 AssignmentExpressionOp                  ::= <LeftHandSideExpressionAddr> <S>? <AssignmentOperator> <S>? <AssignmentExpression>
322 AssignmentExpression                    ::= <AssignmentExpressionOp> | <ConditionalExpression>
323 AssignmentOperator                              ::= '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '>>>=' | '&=' | '^=' | '|='
324
325
326 # 11.14 Comma Operator  ( , )
327 Expression                                      ::= <AssignmentExpression> ( <S>? ',' <S>? <AssignmentExpression> )*
328
329
330 # 12 Statements
331 Statement                                               ::= <FunctionDeclarationStatement> |
332                                                                 <ExpressionStatement> |
333                                                                         <ContinueStatement> |
334                                                                         <Block> |
335                                                                 <Comment> |
336                                                                 <VariableStatement> |
337                                                                 <EmptyStatement> |
338                                                                 <IfStatement> |
339                                                                 <IterationStatement> |
340                                                                 <ContinueStatement> |
341                                                                 <BreakStatement> |
342                                                                 <ReturnStatement> |
343                                                                 <WithStatement> |
344                                                                 <SwitchStatementOp>
345
346 # 12.1 Block
347 Block                                                           ::= <S>? '{' <S>? <StatementList>? <S>? '}' <S>?
348 StatementList                                           ::= (<S>? <Statement>)+
349
350 # 12.2 Variable Statement
351 VariableStatement                                       ::= 'var' <S>? <VariableDeclarationList> <SC>
352 VariableDeclarationList                         ::= <VariableDeclaration> (<COMMA> <VariableDeclaration> )*
353 VariableAllocate                                        ::= <IdentifierNoEmit>
354 VariableAllocateAndInit                         ::= <IdentifierNoEmit>
355 VariableDeclaration                                     ::= <VariableAllocateAndInit> <Initialiser> | <VariableAllocate>
356 Initialiser                                                     ::= <EQ> <AssignmentExpression>
357
358
359 # 12.3 Empty Statement
360 EmptyStatement                                          ::= <SC>
361
362 # 12.4 Expression Statement
363 ExpressionStatement                             ::= (<Expression> - ('function' | '{')) <SC>
364
365
366 # 12.5 The if Statement
367 IfConditionOp                                           ::= 'if' <S>? '(' <S>? <Expression> <S>? ')'
368 IfTrueStatement                                         ::= <Statement>
369 IfFalseStatement                                        ::= <Statement>
370 IfStatement                                                     ::= <IfConditionOp> <S>? <IfTrueStatement> <S>? 'else' <S>? <IfFalseStatement> |
371                                                                         <IfConditionOp> <S>? <IfTrueStatement> 
372
373 # 12.6 Iteration Statements
374 # 12.6a Iteration do ... while() 
375 DoWhileExpressionCompare                        ::= <Expression>
376 IterationDo                                                     ::= 'do' <S>? <Statement> <S>? 'while' <S>? '(' <S>? <DoWhileExpressionCompare> <S>? ')' (<S>? ';')
377
378 # 12.6b Iteration while()
379 WhileExpressionCompare                          ::= <Expression>
380 IterationWhile                                          ::= 'while' <S>? '(' <S>? <WhileExpressionCompare> <S>? ')' <S>? <Statement>
381
382 # 12.6c Iteration for ( ; ; )
383 ExpressionNoIn                                          ::= <Expression>
384 ForExpressionInit                                       ::= ('var' <S>? <VariableDeclarationList>) | <ExpressionNoIn>
385 ForExpressionCompare                            ::= <Expression>
386 ForExpressionIncrement                          ::= <Expression>
387 ForIterationStatement                           ::= <Statement>
388 IterationFor                                            ::= 'for' <S>? '(' <S>? <ForExpressionInit>? <S>? ';' <S>? <ForExpressionCompare>? <S>? ';' <S>? <ForExpressionIncrement>? <S>? ')' <S>? <ForIterationStatement>
389
390
391 IterationStatement                                      ::= <IterationWhile> |
392                                                                                 <IterationFor> |
393                                                                         <IterationDo>
394
395 # 12.9 The return Statement
396 ReturnOp                                                        ::= ('return' - 'return' <IdentifierPart>) <WhiteSpace>* <AssignmentExpression>? (<S>? ';')
397 ReturnStatement                                         ::= ('return' - 'return' <IdentifierPart>) <WhiteSpace>* <AssignmentExpression>? (<S>? ';')
398
399 # The Break Statement
400 BreakOp                                                         ::= 'break' - 'break' <IdentifierPart>
401 BreakStatement                                          ::= <S>? <BreakOp> <SC>
402
403 # The Continue Statement
404 ContinueOp                                                      ::= 'continue' - 'continue' <IdentifierPart>
405 ContinueStatement                                       ::= <S>? <ContinueOp> <SC>
406
407
408
409 # 12.10 The with Statement
410 WithStatement                                           ::= 'with' <S>? '(' <S>? <Expression> <S>? ')' <S>? <Statement>
411
412
413 # 12.11 The switch Statement
414 SwitchExpressionOp                                      ::= ('switch' - 'switch' <IdentifierPart>) <S>? '(' <S>? <Expression> <S>? ')'
415 SwitchStatementOp                                       ::= <SwitchExpressionOp> <S>? <CaseBlock>
416
417 CaseBlock                                                       ::= '{' <S>? <CaseClauses>? <S>? <DefaultClauseOp>? <S>? <CaseClauses>? <S>? '}' |
418                                                                         '{' <S>? <CaseClauses>? <S>? '}'
419
420
421
422 CaseClauses                                             ::= (<S>? <CaseClauseOp>)+
423 CaseExpressionOp                                        ::= ('case' - 'case' <IdentifierPart>) <S>? <Expression> <S>? ':'
424 CaseClauseOp                                            ::= <CaseExpressionOp> <S>? <StatementList>?
425 DefaultKeywordOp                                        ::= 'default' - 'default' <IdentifierPart>
426 DefaultClauseOp                                         ::= <DefaultKeywordOp> <S>? ':' <S>? <StatementList>?
427
428
429 # 13 Function Definition
430 FunctionName                                            ::= <IdentifierNoEmit>
431 FunctionNameAlloc                                       ::= <IdentifierNoEmit>
432 FunctionDeclaration                                     ::= ('function'-'function'<IdentifierPart>)<S>?<FunctionNameAlloc><S>?'('<S>?<FormalParameterList>?<S>?')'<S>?'{'<S>?<FunctionBody>?<S>?'}'
433 FunctionExpression                                      ::= ('function'-'function'<IdentifierPart>)<S>?<FunctionNameAlloc>?<S>?'('<S>?<FormalParameterList>?<S>?')'<S>?'{'<S>?<FunctionBody>?<S>?'}'
434 FormalParameterList                             ::= <FunctionParameter> ( <S>? ',' <S>? <FunctionParameter> )*
435 FunctionParameter                                       ::= <IdentifierNoEmit>
436 FunctionBody                                            ::= <SourceElements>
437 FunctionDeclarationStatement            ::= ('function' - 'function' <IdentifierPart>)<S>?<FunctionName><S>?'('<S>?<FormalParameterList>?<S>?')' <SC>
438
439 # FunctionName                                          ::= <IdentifierNoEmit>
440 # FunctionNameLookupAlloc                       ::= <IdentifierNoEmit>
441 # FunctionDefinition                            ::= ('function' - 'function' <IdentifierPart>)<S>?<FunctionName><S>?'('<S>?<FormalParameterList>?<S>?')'
442 # FunctionDeclaration                           ::= <FunctionDefinition><S>?'{'<S>?<FunctionBody>?<S>?'}'
443 # FunctionExpression                            ::= ('function' - 'function'<IdentifierPart>)<S>?<FunctionName>?<S>?'('<S>?<FormalParameterList>?<S>?')'<S>?'{'<S>?<FunctionBody>?<S>?'}'
444 # FunctionParameter                             ::= <Identifier>
445 # FormalParameterList                           ::= <FunctionParameter> ( <S>? ',' <S>? <FunctionParameter> )*
446 # FunctionDefinitionStatement           ::= ('function' - 'function' <IdentifierPart>)<S>?<FunctionNameLookupAlloc><S>?'('<S>?<FormalParameterList>?<S>?')' <SC>
447 # FunctionBody                                          ::= <SourceElements>
448
449
450 # 14 Program
451 SyntaxError                                             ::= (. - <SC>)+ <SC>?
452 SourceElements                                  ::= (<S>? <SourceElement>)+
453 SourceElement                                   ::= <FunctionDeclaration> |
454                                                                 <Statement> 
455 Program                                                 ::= <SourceElements>
456 # The root rule, it is anonymous
457 <Program>
458
459