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