~mna/snow unlisted

snow/doc/swift.ebnf -rw-r--r-- 38.6 KiB
424066c5Martin Angers doc: v0.0.5 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
Type    Function-Type 
Type    Array-Type 
Type    Dictionary-Type 
Type    Type-Identifier 
Type    Tuple-Type 
Type    Optional-Type 
Type    Implicitly-Unwrapped-Optional-Type 
Type    Protocol-Composition-Type 
Type    Opaque-Type 
Type    Metatype-Type 
Type    Self-Type 
Type     "Any"  
Type     "("  Type  ")"  

Type-Annotation     ":"  [ Attributes ] [  "inout"  ] Type 

Type-Identifier    Type-Name [ Generic-Argument-Clause ] | Type-Name [ Generic-Argument-Clause ]  "."  Type-Identifier 
Type-Name    Identifier 

Tuple-Type     "("   ")"  |  "("  Tuple-Type-Element  ","  Tuple-Type-Element-List  ")"  
Tuple-Type-Element-List    Tuple-Type-Element | Tuple-Type-Element  ","  Tuple-Type-Element-List 
Tuple-Type-Element    Element-Name Type-Annotation | Type 
Element-Name    Identifier 

Function-Type    [ Attributes ] Function-Type-Argument-Clause [  "throws"  ]  "->"  Type 

Function-Type-Argument-Clause     "("   ")"  
Function-Type-Argument-Clause     "("  Function-Type-Argument-List [  "..."  ]  ")"  

Function-Type-Argument-List    Function-Type-Argument | Function-Type-Argument  ","  Function-Type-Argument-List 
Function-Type-Argument    [ Attributes ] [  "inout"  ] Type | Argument-Label Type-Annotation 
Argument-Label    Identifier 

Array-Type     "["  Type  "]"  

Dictionary-Type     "["  Type  ":"  Type  "]"  

Optional-Type    Type  "?"  

Implicitly-Unwrapped-Optional-Type    Type  "!"  

Protocol-Composition-Type    Type-Identifier  "&"  Protocol-Composition-Continuation 
Protocol-Composition-Continuation    Type-Identifier | Protocol-Composition-Type 

Opaque-Type     "some"  Type 

Metatype-Type    Type  "."   "Type"  | Type  "."   "Protocol"  

Self-Type     "Self"  

Type-Inheritance-Clause     ":"  Type-Inheritance-List 
Type-Inheritance-List    Type-Identifier | Type-Identifier  ","  Type-Inheritance-List 

Expression    [ Try-Operator ] Prefix-Expression [ Binary-Expressions ] 
Expression-List    Expression | Expression  ","  Expression-List 

Prefix-Expression    [ Prefix-Operator ] Postfix-Expression 
Prefix-Expression    In-Out-Expression 
In-Out-Expression     "&"  Identifier 

Try-Operator     "try"  |  "try"   "?"  |  "try"   "!"  

Binary-Expression    Binary-Operator Prefix-Expression 
Binary-Expression    Assignment-Operator [ Try-Operator ] Prefix-Expression 
Binary-Expression    Conditional-Operator [ Try-Operator ] Prefix-Expression 
Binary-Expression    Type-Casting-Operator 
Binary-Expressions    Binary-Expression [ Binary-Expressions ] 

Assignment-Operator     "="  

Conditional-Operator  →   "?"  Expression  ":"  

Type-Casting-Operator  →   "is"  Type 
Type-Casting-Operator  →   "as"  Type 
Type-Casting-Operator  →   "as"   "?"  Type 
Type-Casting-Operator  →   "as"   "!"  Type 

Primary-Expression  →  Identifier [ Generic-Argument-Clause ] 
Primary-Expression  →  Literal-Expression 
Primary-Expression  →  Self-Expression 
Primary-Expression  →  Superclass-Expression 
Primary-Expression  →  Closure-Expression 
Primary-Expression  →  Parenthesized-Expression 
Primary-Expression  →  Tuple-Expression 
Primary-Expression  →  Implicit-Member-Expression 
Primary-Expression  →  Wildcard-Expression 
Primary-Expression  →  Key-Path-Expression 
Primary-Expression  →  Selector-Expression 
Primary-Expression  →  Key-Path-String-Expression 

Literal-Expression  →  Literal 
Literal-Expression  →  Array-Literal | Dictionary-Literal | Playground-Literal 
Literal-Expression  →   "#file"  |  "#line"  |  "#column"  |  "#function"  |  "#dsohandle"  

Array-Literal  →   "["  [ Array-Literal-Items ]  "]"  
Array-Literal-Items  →  Array-Literal-Item [  ","  ] | Array-Literal-Item  ","  Array-Literal-Items 
Array-Literal-Item  →  Expression 

Dictionary-Literal  →   "["  Dictionary-Literal-Items  "]"  |  "["   ":"   "]"  
Dictionary-Literal-Items  →  Dictionary-Literal-Item [  ","  ] | Dictionary-Literal-Item  ","  Dictionary-Literal-Items 
Dictionary-Literal-Item  →  Expression  ":"  Expression 

Playground-Literal  →   "#colorLiteral"   "("   "red"   ":"  Expression  ","   "green"   ":"  Expression  ","   "blue"   ":"  Expression  ","   "alpha"   ":"  Expression  ")"  
Playground-Literal  →   "#fileLiteral"   "("   "resourceName"   ":"  Expression  ")"  
Playground-Literal  →   "#imageLiteral"   "("   "resourceName"   ":"  Expression  ")"  

Self-Expression  →   "self"  | Self-Method-Expression | Self-Subscript-Expression | Self-Initializer-Expression 

Self-Method-Expression  →   "self"   "."  Identifier 
Self-Subscript-Expression     "self"   "["  Function-Call-Argument-List  "]"  
Self-Initializer-Expression     "self"   "."   "init"  

Superclass-Expression    Superclass-Method-Expression | Superclass-Subscript-Expression | Superclass-Initializer-Expression 

Superclass-Method-Expression     "super"   "."  Identifier 
Superclass-Subscript-Expression     "super"   "["  Function-Call-Argument-List  "]"  
Superclass-Initializer-Expression     "super"   "."   "init"  

Closure-Expression     "{"  [ Closure-Signature ] [ Statements ]  "}"  

Closure-Signature    [ Capture-List ] Closure-Parameter-Clause [  "throws"  ] [ Function-Result ]  "in"  
Closure-Signature    Capture-List  "in"  

Closure-Parameter-Clause     "("   ")"  |  "("  Closure-Parameter-List  ")"  | Identifier-List 
Closure-Parameter-List    Closure-Parameter | Closure-Parameter  ","  Closure-Parameter-List 
Closure-Parameter    Closure-Parameter-Name [ Type-Annotation ] 
Closure-Parameter    Closure-Parameter-Name Type-Annotation  "..."  
Closure-Parameter-Name    Identifier 

Capture-List     "["  Capture-List-Items  "]"  
Capture-List-Items    Capture-List-Item | Capture-List-Item  ","  Capture-List-Items 
Capture-List-Item    [ Capture-Specifier ] Expression 
Capture-Specifier     "weak"  |  "unowned"  |  "unowned(safe)"  |  "unowned(unsafe)"  

Implicit-Member-Expression     "."  Identifier 

Parenthesized-Expression     "("  Expression  ")"  

Tuple-Expression     "("   ")"  |  "("  Tuple-Element  ","  Tuple-Element-List  ")"  
Tuple-Element-List    Tuple-Element | Tuple-Element  ","  Tuple-Element-List 
Tuple-Element    Expression | Identifier  ":"  Expression 

Wildcard-Expression     "_"  

Key-Path-Expression     "\"  [ Type ]  "."  Key-Path-Components 
Key-Path-Components    Key-Path-Component | Key-Path-Component  "."  Key-Path-Components 
Key-Path-Component    Identifier [ Key-Path-Postfixes ] | Key-Path-Postfixes 

Key-Path-Postfixes    Key-Path-Postfix [ Key-Path-Postfixes ] 
Key-Path-Postfix     "?"  |  "!"  |  "self"  |  "["  Function-Call-Argument-List  "]"  

Selector-Expression     "#selector"   "("  Expression  ")"  
Selector-Expression     "#selector"   "("   "getter:"  Expression  ")"  
Selector-Expression     "#selector"   "("   "setter:"  Expression  ")"  

Key-Path-String-Expression     "#keyPath"   "("  Expression  ")"  

Postfix-Expression    Primary-Expression 
Postfix-Expression    Postfix-Expression Postfix-Operator 
Postfix-Expression    Function-Call-Expression 
Postfix-Expression    Initializer-Expression 
Postfix-Expression    Explicit-Member-Expression 
Postfix-Expression    Postfix-Self-Expression 
Postfix-Expression    Subscript-Expression 
Postfix-Expression    Forced-Value-Expression 
Postfix-Expression    Optional-Chaining-Expression 

Function-Call-Expression    Postfix-Expression Function-Call-Argument-Clause 
Function-Call-Expression    Postfix-Expression [ Function-Call-Argument-Clause ] Trailing-Closure 

Function-Call-Argument-Clause     "("   ")"  |  "("  Function-Call-Argument-List  ")"  
Function-Call-Argument-List    Function-Call-Argument | Function-Call-Argument  ","  Function-Call-Argument-List 
Function-Call-Argument    Expression | Identifier  ":"  Expression 
Function-Call-Argument    Operator | Identifier  ":"  Operator 

Trailing-Closure    Closure-Expression 

Initializer-Expression    Postfix-Expression  "."   "init"  
Initializer-Expression    Postfix-Expression  "."   "init"   "("  Argument-Names  ")"  

Explicit-Member-Expression    Postfix-Expression  "."  Decimal-Digits 
Explicit-Member-Expression    Postfix-Expression  "."  Identifier [ Generic-Argument-Clause ] 
Explicit-Member-Expression    Postfix-Expression  "."  Identifier  "("  Argument-Names  ")"  

Argument-Names    Argument-Name [ Argument-Names ] 
Argument-Name    Identifier  ":"  

Postfix-Self-Expression    Postfix-Expression  "."   "self"  

Subscript-Expression    Postfix-Expression  "["  Function-Call-Argument-List  "]"  

Forced-Value-Expression    Postfix-Expression  "!"  

Optional-Chaining-Expression    Postfix-Expression  "?"  

Statement    Expression [  ";"  ] 
Statement    Declaration [  ";"  ] 
Statement    Loop-Statement [  ";"  ] 
Statement    Branch-Statement [  ";"  ] 
Statement    Labeled-Statement [  ";"  ] 
Statement    Control-Transfer-Statement [  ";"  ] 
Statement    Defer-Statement [  ";"  ] 
Statement    Do-Statement [  ";"  ] 
Statement    Compiler-Control-Statement 
Statements    Statement [ Statements ] 

Loop-Statement    For-In-Statement 
Loop-Statement    While-Statement 
Loop-Statement    Repeat-While-Statement 

For-In-Statement     "for"  [  "case"  ] Pattern  "in"  Expression [ Where-Clause ] Code-Block 

While-Statement     "while"  Condition-List Code-Block 

Condition-List    Condition | Condition  ","  Condition-List 
Condition    Expression | Availability-Condition | Case-Condition | Optional-Binding-Condition 

Case-Condition     "case"  Pattern Initializer 
Optional-Binding-Condition     "let"  Pattern Initializer |  "var"  Pattern Initializer 

Repeat-While-Statement     "repeat"  Code-Block  "while"  Expression 

Branch-Statement    If-Statement 
Branch-Statement    Guard-Statement 
Branch-Statement    Switch-Statement 

If-Statement     "if"  Condition-List Code-Block [ Else-Clause ] 
Else-Clause     "else"  Code-Block |  "else"  If-Statement 

Guard-Statement     "guard"  Condition-List  "else"  Code-Block 

Switch-Statement     "switch"  Expression  "{"  [ Switch-Cases ]  "}"  
Switch-Cases    Switch-Case [ Switch-Cases ] 
Switch-Case    Case-Label Statements 
Switch-Case    Default-Label Statements 
Switch-Case    Conditional-Switch-Case 

Case-Label    [ Attributes ]  "case"  Case-Item-List  ":"  
Case-Item-List    Pattern [ Where-Clause ] | Pattern [ Where-Clause ]  ","  Case-Item-List 
Default-Label    [ Attributes ]  "default"   ":"  

Where-Clause     "where"  Where-Expression 
Where-Expression    Expression 

Conditional-Switch-Case    Switch-If-Directive-Clause [ Switch-Elseif-Directive-Clauses ] [ Switch-Else-Directive-Clause ] Endif-Directive 
Switch-If-Directive-Clause    If-Directive Compilation-Condition [ Switch-Cases ] 
Switch-Elseif-Directive-Clauses    Elseif-Directive-Clause [ Switch-Elseif-Directive-Clauses ] 
Switch-Elseif-Directive-Clause    Elseif-Directive Compilation-Condition [ Switch-Cases ] 
Switch-Else-Directive-Clause    Else-Directive [ Switch-Cases ] 

Labeled-Statement    Statement-Label Loop-Statement 
Labeled-Statement    Statement-Label If-Statement 
Labeled-Statement    Statement-Label Switch-Statement 
Labeled-Statement    Statement-Label Do-Statement 

Statement-Label    Label-Name  ":"  
Label-Name    Identifier 

Control-Transfer-Statement    Break-Statement 
Control-Transfer-Statement    Continue-Statement 
Control-Transfer-Statement    Fallthrough-Statement 
Control-Transfer-Statement    Return-Statement 
Control-Transfer-Statement    Throw-Statement 

Break-Statement     "break"  [ Label-Name ] 

Continue-Statement     "continue"  [ Label-Name ] 

Fallthrough-Statement     "fallthrough"  

Return-Statement     "return"  [ Expression ] 

Throw-Statement     "throw"  Expression 

Defer-Statement     "defer"  Code-Block 

Do-Statement     "do"  Code-Block [ Catch-Clauses ] 
Catch-Clauses    Catch-Clause [ Catch-Clauses ] 
Catch-Clause     "catch"  [ Pattern ] [ Where-Clause ] Code-Block 

Compiler-Control-Statement    Conditional-Compilation-Block 
Compiler-Control-Statement    Line-Control-Statement 
Compiler-Control-Statement    Diagnostic-Statement 

Conditional-Compilation-Block    If-Directive-Clause [ Elseif-Directive-Clauses ] [ Else-Directive-Clause ] Endif-Directive 

If-Directive-Clause    If-Directive Compilation-Condition [ Statements ] 
Elseif-Directive-Clauses    Elseif-Directive-Clause [ Elseif-Directive-Clauses ] 
Elseif-Directive-Clause    Elseif-Directive Compilation-Condition [ Statements ] 
Else-Directive-Clause    Else-Directive [ Statements ] 
If-Directive     "#if"  
Elseif-Directive     "#elseif"  
Else-Directive     "#else"  
Endif-Directive     "#endif"  

Compilation-Condition    Platform-Condition 
Compilation-Condition    Identifier 
Compilation-Condition    Boolean-Literal 
Compilation-Condition     "("  Compilation-Condition  ")"  
Compilation-Condition     "!"  Compilation-Condition 
Compilation-Condition    Compilation-Condition  "&&"  Compilation-Condition 
Compilation-Condition    Compilation-Condition  "||"  Compilation-Condition 

Platform-Condition     "os"   "("  Operating-System  ")"  
Platform-Condition     "arch"   "("  Architecture  ")"  
Platform-Condition     "swift"   "("   ">="  Swift-Version  ")"  |  "swift"   "("   "<"  Swift-Version  ")"  
Platform-Condition  →   "compiler"   "("   ">="  Swift-Version  ")"  |  "compiler"   "("   "<"  Swift-Version  ")"  
Platform-Condition  →   "canImport"   "("  Module-Name  ")"  
Platform-Condition  →   "targetEnvironment"   "("  Environment  ")"  

Operating-System  →   "macOS"  |  "iOS"  |  "watchOS"  |  "tvOS"  
Architecture  →   "i386"  |  "x86_64"  |  "arm"  |  "arm64"  
Swift-Version  →  Decimal-Digits [ Swift-Version-Continuation ] 
Swift-Version-Continuation  →   "."  Decimal-Digits [ Swift-Version-Continuation ] 
Module-Name    Identifier 
Environment     "simulator"  

Line-Control-Statement     "#sourceLocation"   "("   "file:"  File-Name  ","   "line:"  Line-Number  ")"  
Line-Control-Statement     "#sourceLocation"   "("   ")"  
Line-Number    A decimal integer greater than zero 
File-Name    Static-String-Literal 

Diagnostic-Statement     "#error"   "("  Diagnostic-Message  ")"  
Diagnostic-Statement     "#warning"   "("  Diagnostic-Message  ")"  

Diagnostic-Message    Static-String-Literal 

Availability-Condition     "#available"   "("  Availability-Arguments  ")"  
Availability-Arguments    Availability-Argument | Availability-Argument  ","  Availability-Arguments 
Availability-Argument    Platform-Name Platform-Version 
Availability-Argument     "*"  

Platform-Name     "iOS"  |  "iOSApplicationExtension"  
Platform-Name     "macOS"  |  "macOSApplicationExtension"  
Platform-Name     "watchOS"  
Platform-Name     "tvOS"  
Platform-Version    Decimal-Digits 
Platform-Version    Decimal-Digits  "."  Decimal-Digits 
Platform-Version    Decimal-Digits  "."  Decimal-Digits  "."  Decimal-Digits 

Declaration    Import-Declaration 
Declaration    Constant-Declaration 
Declaration    Variable-Declaration 
Declaration    Typealias-Declaration 
Declaration    Function-Declaration 
Declaration    Enum-Declaration 
Declaration    Struct-Declaration 
Declaration    Class-Declaration 
Declaration    Protocol-Declaration 
Declaration    Initializer-Declaration 
Declaration    Deinitializer-Declaration 
Declaration    Extension-Declaration 
Declaration    Subscript-Declaration 
Declaration    Operator-Declaration 
Declaration    Precedence-Group-Declaration 
Declarations    Declaration [ Declarations ] 

Top-Level-Declaration    [ Statements ] 

Code-Block     "{"  [ Statements ]  "}"  

Import-Declaration    [ Attributes ]  "import"  [ Import-Kind ] Import-Path 

Import-Kind     "typealias"  |  "struct"  |  "class"  |  "enum"  |  "protocol"  |  "let"  |  "var"  |  "func"  
Import-Path    Import-Path-Identifier | Import-Path-Identifier  "."  Import-Path 
Import-Path-Identifier    Identifier | Operator 

Constant-Declaration    [ Attributes ] [ Declaration-Modifiers ]  "let"  Pattern-Initializer-List 

Pattern-Initializer-List    Pattern-Initializer | Pattern-Initializer  ","  Pattern-Initializer-List 
Pattern-Initializer    Pattern [ Initializer ] 
Initializer     "="  Expression 

Variable-Declaration  →  Variable-Declaration-Head Pattern-Initializer-List 

# the rest of the variable declaration productions are just special case where a single
# variable can be on the left side, and the type or init is followed by special getter/setter/etc.
# The only real general declaration form is the one above (and the equivalent Constant-Declaration).
Variable-Declaration  →  Variable-Declaration-Head Variable-Name Type-Annotation Code-Block 
Variable-Declaration  →  Variable-Declaration-Head Variable-Name Type-Annotation Getter-Setter-Block 
Variable-Declaration  →  Variable-Declaration-Head Variable-Name Type-Annotation Getter-Setter-Keyword-Block 
Variable-Declaration  →  Variable-Declaration-Head Variable-Name Initializer WillSet-DidSet-Block 
Variable-Declaration  →  Variable-Declaration-Head Variable-Name Type-Annotation [ Initializer ] WillSet-DidSet-Block 

Variable-Declaration-Head  →  [ Attributes ] [ Declaration-Modifiers ]  "var"  
Variable-Name  →  Identifier 

Getter-Setter-Block  →  Code-Block 
Getter-Setter-Block  →   "{"  Getter-Clause [ Setter-Clause ]  "}"  
Getter-Setter-Block  →   "{"  Setter-Clause Getter-Clause  "}"  
Getter-Clause  →  [ Attributes ] [ Mutation-Modifier ]  "get"  Code-Block 
Setter-Clause  →  [ Attributes ] [ Mutation-Modifier ]  "set"  [ Setter-Name ] Code-Block 
Setter-Name  →   "("  Identifier  ")"  

Getter-Setter-Keyword-Block  →   "{"  Getter-Keyword-Clause [ Setter-Keyword-Clause ]  "}"  
Getter-Setter-Keyword-Block  →   "{"  Setter-Keyword-Clause Getter-Keyword-Clause  "}"  
Getter-Keyword-Clause  →  [ Attributes ] [ Mutation-Modifier ]  "get"  
Setter-Keyword-Clause  →  [ Attributes ] [ Mutation-Modifier ]  "set"  

WillSet-DidSet-Block  →   "{"  WillSet-Clause [ DidSet-Clause ]  "}"  
WillSet-DidSet-Block  →   "{"  DidSet-Clause [ WillSet-Clause ]  "}"  
WillSet-Clause  →  [ Attributes ]  "willSet"  [ Setter-Name ] Code-Block 
DidSet-Clause  →  [ Attributes ]  "didSet"  [ Setter-Name ] Code-Block 

Typealias-Declaration  →  [ Attributes ] [ Access-Level-Modifier ]  "typealias"  Typealias-Name [ Generic-Parameter-Clause ] Typealias-Assignment 
Typealias-Name  →  Identifier 
Typealias-Assignment  →   "="  Type 

Function-Declaration  →  Function-Head Function-Name [ Generic-Parameter-Clause ] Function-Signature [ Generic-Where-Clause ] [ Function-Body ] 

Function-Head  →  [ Attributes ] [ Declaration-Modifiers ]  "func"  
Function-Name  →  Identifier | Operator 

Function-Signature  →  Parameter-Clause [  "throws"  ] [ Function-Result ] 
Function-Signature  →  Parameter-Clause  "rethrows"  [ Function-Result ] 
Function-Result  →   "->"  [ Attributes ] Type 
Function-Body  →  Code-Block 

Parameter-Clause  →   "("   ")"  |  "("  Parameter-List  ")"  
Parameter-List  →  Parameter | Parameter  ","  Parameter-List 
Parameter  →  [ External-Parameter-Name ] Local-Parameter-Name Type-Annotation [ Default-Argument-Clause ] 
Parameter  →  [ External-Parameter-Name ] Local-Parameter-Name Type-Annotation 
Parameter  →  [ External-Parameter-Name ] Local-Parameter-Name Type-Annotation  "..."  
External-Parameter-Name    Identifier 
Local-Parameter-Name    Identifier 
Default-Argument-Clause     "="  Expression 

Enum-Declaration  →  [ Attributes ] [ Access-Level-Modifier ] Union-Style-Enum 
Enum-Declaration  →  [ Attributes ] [ Access-Level-Modifier ] Raw-Value-Style-Enum 

Union-Style-Enum  →  [  "indirect"  ]  "enum"  Enum-Name [ Generic-Parameter-Clause ] [ Type-Inheritance-Clause ] [ Generic-Where-Clause ]  "{"  [ Union-Style-Enum-Members ]  "}"  
Union-Style-Enum-Members  →  Union-Style-Enum-Member [ Union-Style-Enum-Members ] 
Union-Style-Enum-Member  →  Declaration | Union-Style-Enum-Case-Clause | Compiler-Control-Statement 
Union-Style-Enum-Case-Clause  →  [ Attributes ] [  "indirect"  ]  "case"  Union-Style-Enum-Case-List 
Union-Style-Enum-Case-List  →  Union-Style-Enum-Case | Union-Style-Enum-Case  ","  Union-Style-Enum-Case-List 
Union-Style-Enum-Case  →  Enum-Case-Name [ Tuple-Type ] 
Enum-Name  →  Identifier 
Enum-Case-Name  →  Identifier 

Raw-Value-Style-Enum  →   "enum"  Enum-Name [ Generic-Parameter-Clause ] Type-Inheritance-Clause [ Generic-Where-Clause ]  "{"  Raw-Value-Style-Enum-Members  "}"  
Raw-Value-Style-Enum-Members  →  Raw-Value-Style-Enum-Member [ Raw-Value-Style-Enum-Members ] 
Raw-Value-Style-Enum-Member  →  Declaration | Raw-Value-Style-Enum-Case-Clause | Compiler-Control-Statement 
Raw-Value-Style-Enum-Case-Clause  →  [ Attributes ]  "case"  Raw-Value-Style-Enum-Case-List 
Raw-Value-Style-Enum-Case-List  →  Raw-Value-Style-Enum-Case | Raw-Value-Style-Enum-Case  ","  Raw-Value-Style-Enum-Case-List 
Raw-Value-Style-Enum-Case  →  Enum-Case-Name [ Raw-Value-Assignment ] 
Raw-Value-Assignment  →   "="  Raw-Value-Literal 
Raw-Value-Literal  →  Numeric-Literal | Static-String-Literal | Boolean-Literal 

Struct-Declaration  →  [ Attributes ] [ Access-Level-Modifier ]  "struct"  Struct-Name [ Generic-Parameter-Clause ] [ Type-Inheritance-Clause ] [ Generic-Where-Clause ] Struct-Body 
Struct-Name  →  Identifier 
Struct-Body  →   "{"  [ Struct-Members ]  "}"  

Struct-Members  →  Struct-Member [ Struct-Members ] 
Struct-Member  →  Declaration | Compiler-Control-Statement 

Class-Declaration  →  [ Attributes ] [ Access-Level-Modifier ] [  "final"  ]  "class"  Class-Name [ Generic-Parameter-Clause ] [ Type-Inheritance-Clause ] [ Generic-Where-Clause ] Class-Body 
Class-Declaration  →  [ Attributes ]  "final"  [ Access-Level-Modifier ]  "class"  Class-Name [ Generic-Parameter-Clause ] [ Type-Inheritance-Clause ] [ Generic-Where-Clause ] Class-Body 
Class-Name  →  Identifier 
Class-Body  →   "{"  [ Class-Members ]  "}"  

Class-Members  →  Class-Member [ Class-Members ] 
Class-Member  →  Declaration | Compiler-Control-Statement 

Protocol-Declaration  →  [ Attributes ] [ Access-Level-Modifier ]  "protocol"  Protocol-Name [ Type-Inheritance-Clause ] [ Generic-Where-Clause ] Protocol-Body 
Protocol-Name  →  Identifier 
Protocol-Body  →   "{"  [ Protocol-Members ]  "}"  

Protocol-Members  →  Protocol-Member [ Protocol-Members ] 
Protocol-Member  →  Protocol-Member-Declaration | Compiler-Control-Statement 

Protocol-Member-Declaration  →  Protocol-Property-Declaration 
Protocol-Member-Declaration  →  Protocol-Method-Declaration 
Protocol-Member-Declaration  →  Protocol-Initializer-Declaration 
Protocol-Member-Declaration  →  Protocol-Subscript-Declaration 
Protocol-Member-Declaration  →  Protocol-Associated-Type-Declaration 
Protocol-Member-Declaration  →  Typealias-Declaration 

Protocol-Property-Declaration  →  Variable-Declaration-Head Variable-Name Type-Annotation Getter-Setter-Keyword-Block 

Protocol-Method-Declaration  →  Function-Head Function-Name [ Generic-Parameter-Clause ] Function-Signature [ Generic-Where-Clause ] 

Protocol-Initializer-Declaration  →  Initializer-Head [ Generic-Parameter-Clause ] Parameter-Clause [  "throws"  ] [ Generic-Where-Clause ] 
Protocol-Initializer-Declaration  →  Initializer-Head [ Generic-Parameter-Clause ] Parameter-Clause  "rethrows"  [ Generic-Where-Clause ] 

Protocol-Subscript-Declaration  →  Subscript-Head Subscript-Result [ Generic-Where-Clause ] Getter-Setter-Keyword-Block 

Protocol-Associated-Type-Declaration  →  [ Attributes ] [ Access-Level-Modifier ]  "associatedtype"  Typealias-Name [ Type-Inheritance-Clause ] [ Typealias-Assignment ] [ Generic-Where-Clause ] 

Initializer-Declaration  →  Initializer-Head [ Generic-Parameter-Clause ] Parameter-Clause [  "throws"  ] [ Generic-Where-Clause ] Initializer-Body 
Initializer-Declaration  →  Initializer-Head [ Generic-Parameter-Clause ] Parameter-Clause  "rethrows"  [ Generic-Where-Clause ] Initializer-Body 
Initializer-Head  →  [ Attributes ] [ Declaration-Modifiers ]  "init"  
Initializer-Head  →  [ Attributes ] [ Declaration-Modifiers ]  "init"   "?"  
Initializer-Head  →  [ Attributes ] [ Declaration-Modifiers ]  "init"   "!"  
Initializer-Body  →  Code-Block 

Deinitializer-Declaration  →  [ Attributes ]  "deinit"  Code-Block 

Extension-Declaration  →  [ Attributes ] [ Access-Level-Modifier ]  "extension"  Type-Identifier [ Type-Inheritance-Clause ] [ Generic-Where-Clause ] Extension-Body 
Extension-Body  →   "{"  [ Extension-Members ]  "}"  

Extension-Members  →  Extension-Member [ Extension-Members ] 
Extension-Member  →  Declaration | Compiler-Control-Statement 

Subscript-Declaration  →  Subscript-Head Subscript-Result [ Generic-Where-Clause ] Code-Block 
Subscript-Declaration  →  Subscript-Head Subscript-Result [ Generic-Where-Clause ] Getter-Setter-Block 
Subscript-Declaration  →  Subscript-Head Subscript-Result [ Generic-Where-Clause ] Getter-Setter-Keyword-Block 
Subscript-Head  →  [ Attributes ] [ Declaration-Modifiers ]  "subscript"  [ Generic-Parameter-Clause ] Parameter-Clause 
Subscript-Result  →   "->"  [ Attributes ] Type 

Operator-Declaration  →  Prefix-Operator-Declaration | Postfix-Operator-Declaration | Infix-Operator-Declaration 

Prefix-Operator-Declaration  →   "prefix"   "operator"  Operator 
Postfix-Operator-Declaration  →   "postfix"   "operator"  Operator 
Infix-Operator-Declaration  →   "infix"   "operator"  Operator [ Infix-Operator-Group ] 

Infix-Operator-Group  →   ":"  Precedence-Group-Name 

Precedence-Group-Declaration  →   "precedencegroup"  Precedence-Group-Name  "{"  [ Precedence-Group-Attributes ]  "}"  

Precedence-Group-Attributes  →  Precedence-Group-Attribute [ Precedence-Group-Attributes ] 
Precedence-Group-Attribute  →  Precedence-Group-Relation 
Precedence-Group-Attribute  →  Precedence-Group-Assignment 
Precedence-Group-Attribute  →  Precedence-Group-Associativity 

Precedence-Group-Relation  →   "higherThan"   ":"  Precedence-Group-Names 
Precedence-Group-Relation  →   "lowerThan"   ":"  Precedence-Group-Names 

Precedence-Group-Assignment  →   "assignment"   ":"  Boolean-Literal 

Precedence-Group-Associativity  →   "associativity"   ":"   "left"  
Precedence-Group-Associativity  →   "associativity"   ":"   "right"  
Precedence-Group-Associativity  →   "associativity"   ":"   "none"  

Precedence-Group-Names  →  Precedence-Group-Name | Precedence-Group-Name  ","  Precedence-Group-Names 
Precedence-Group-Name  →  Identifier 

Declaration-Modifier  →   "class"  |  "convenience"  |  "dynamic"  |  "final"  |  "infix"  |  "lazy"  |  "optional"  |  "override"  |  "postfix"  |  "prefix"  |  "required"  |  "static"  |  "unowned"  |  "unowned"   "("   "safe"   ")"  |  "unowned"   "("   "unsafe"   ")"  |  "weak"  
Declaration-Modifier  →  Access-Level-Modifier 
Declaration-Modifier  →  Mutation-Modifier 
Declaration-Modifiers  →  Declaration-Modifier [ Declaration-Modifiers ] 

Access-Level-Modifier  →   "private"  |  "private"   "("   "set"   ")"  
Access-Level-Modifier  →   "fileprivate"  |  "fileprivate"   "("   "set"   ")"  
Access-Level-Modifier  →   "internal"  |  "internal"   "("   "set"   ")"  
Access-Level-Modifier  →   "public"  |  "public"   "("   "set"   ")"  
Access-Level-Modifier  →   "open"  |  "open"   "("   "set"   ")"  

Mutation-Modifier  →   "mutating"  |  "nonmutating"  

Attribute  →   "@"  Attribute-Name [ Attribute-Argument-Clause ] 
Attribute-Name  →  Identifier 
Attribute-Argument-Clause  →   "("  [ Balanced-Tokens ]  ")"  
Attributes  →  Attribute [ Attributes ] 

Balanced-Tokens  →  Balanced-Token [ Balanced-Tokens ] 
Balanced-Token  →   "("  [ Balanced-Tokens ]  ")"  
Balanced-Token  →   "["  [ Balanced-Tokens ]  "]"  
Balanced-Token  →   "{"  [ Balanced-Tokens ]  "}"  
Balanced-Token  →  Any identifier, keyword, literal, or operator 
Balanced-Token  →  Any punctuation except  "("  ,  ")"  ,  "["  ,  "]"  ,  "{"  , or  "}"  

Pattern  →  Wildcard-Pattern [ Type-Annotation ] 
Pattern  →  Identifier-Pattern [ Type-Annotation ] 
Pattern  →  Value-Binding-Pattern 
Pattern  →  Tuple-Pattern [ Type-Annotation ] 
Pattern  →  Enum-Case-Pattern 
Pattern  →  Optional-Pattern 
Pattern  →  Type-Casting-Pattern 
Pattern  →  Expression-Pattern 

Wildcard-Pattern  →   "_"  

Identifier-Pattern  →  Identifier 

Value-Binding-Pattern  →   "var"  Pattern |  "let"  Pattern 

Tuple-Pattern  →   "("  [ Tuple-Pattern-Element-List ]  ")"  
Tuple-Pattern-Element-List  →  Tuple-Pattern-Element | Tuple-Pattern-Element  ","  Tuple-Pattern-Element-List 
Tuple-Pattern-Element  →  Pattern | Identifier  ":"  Pattern 

Enum-Case-Pattern  →  [ Type-Identifier ]  "."  Enum-Case-Name [ Tuple-Pattern ] 

Optional-Pattern  →  Identifier-Pattern  "?"  

Type-Casting-Pattern  →  Is-Pattern | As-Pattern 
Is-Pattern  →   "is"  Type 
As-Pattern  →  Pattern  "as"  Type 

Expression-Pattern  →  Expression 

Generic-Parameter-Clause  →   "<"  Generic-Parameter-List  ">"  
Generic-Parameter-List  →  Generic-Parameter | Generic-Parameter  ","  Generic-Parameter-List 
Generic-Parameter  →  Type-Name 
Generic-Parameter  →  Type-Name  ":"  Type-Identifier 
Generic-Parameter  →  Type-Name  ":"  Protocol-Composition-Type 

Generic-Where-Clause  →   "where"  Requirement-List 
Requirement-List  →  Requirement | Requirement  ","  Requirement-List 
Requirement  →  Conformance-Requirement | Same-Type-Requirement 

Conformance-Requirement  →  Type-Identifier  ":"  Type-Identifier 
Conformance-Requirement  →  Type-Identifier  ":"  Protocol-Composition-Type 
Same-Type-Requirement  →  Type-Identifier  "=="  Type 

Generic-Argument-Clause  →   "<"  Generic-Argument-List  ">"  
Generic-Argument-List  →  Generic-Argument | Generic-Argument  ","  Generic-Argument-List 
Generic-Argument  →  Type 



########## SCANNER-RELATED PRODUCTIONS ############ 



Whitespace  →  Whitespace-Item [ Whitespace ] 
Whitespace-Item  →  Line-Break 
Whitespace-Item  →  Comment 
Whitespace-Item  →  Multiline-Comment 
Whitespace-Item  →  U+0000, U+0009, U+000B, U+000C, or U+0020 

Line-Break  →  U+000A 
Line-Break  →  U+000D 
Line-Break  →  U+000D followed by U+000A 

Comment  →   "//"  Comment-Text Line-Break 
Multiline-Comment  →   "/*"  Multiline-Comment-Text  "*/"  

Comment-Text  →  Comment-Text-Item [ Comment-Text ] 
Comment-Text-Item  →  Any Unicode scalar value except U+000A or U+000D 

Multiline-Comment-Text  →  Multiline-Comment-Text-Item [ Multiline-Comment-Text ] 
Multiline-Comment-Text-Item  →  Multiline-Comment 
Multiline-Comment-Text-Item  →  Comment-Text-Item 
Multiline-Comment-Text-Item  →  Any Unicode scalar value except  "/*"  or  "*/"  

Identifier  →  Identifier-Head [ Identifier-Characters ] 
Identifier  →   "`"  Identifier-Head [ Identifier-Characters ]  "`"  
Identifier  →  Implicit-Parameter-Name 
Identifier  →  Property-Wrapper-Projection 
Identifier-List  →  Identifier | Identifier  ","  Identifier-List 

Identifier-Head  →  Upper- or lowercase letter A through Z 
Identifier-Head  →   "_"  
Identifier-Head  →  U+00A8, U+00AA, U+00AD, U+00AF, U+00B2–U+00B5, or U+00B7–U+00BA 
Identifier-Head  →  U+00BC–U+00BE, U+00C0–U+00D6, U+00D8–U+00F6, or U+00F8–U+00FF 
Identifier-Head  →  U+0100–U+02FF, U+0370–U+167F, U+1681–U+180D, or U+180F–U+1DBF 
Identifier-Head  →  U+1E00–U+1FFF 
Identifier-Head  →  U+200B–U+200D, U+202A–U+202E, U+203F–U+2040, U+2054, or U+2060–U+206F 
Identifier-Head  →  U+2070–U+20CF, U+2100–U+218F, U+2460–U+24FF, or U+2776–U+2793 
Identifier-Head  →  U+2C00–U+2DFF or U+2E80–U+2FFF 
Identifier-Head  →  U+3004–U+3007, U+3021–U+302F, U+3031–U+303F, or U+3040–U+D7FF 
Identifier-Head  →  U+F900–U+FD3D, U+FD40–U+FDCF, U+FDF0–U+FE1F, or U+FE30–U+FE44 
Identifier-Head  →  U+FE47–U+FFFD 
Identifier-Head  →  U+10000–U+1FFFD, U+20000–U+2FFFD, U+30000–U+3FFFD, or U+40000–U+4FFFD 
Identifier-Head  →  U+50000–U+5FFFD, U+60000–U+6FFFD, U+70000–U+7FFFD, or U+80000–U+8FFFD 
Identifier-Head  →  U+90000–U+9FFFD, U+A0000–U+AFFFD, U+B0000–U+BFFFD, or U+C0000–U+CFFFD 
Identifier-Head  →  U+D0000–U+DFFFD or U+E0000–U+EFFFD 

Identifier-Character  →  Digit 0 through 9 
Identifier-Character  →  U+0300–U+036F, U+1DC0–U+1DFF, U+20D0–U+20FF, or U+FE20–U+FE2F 
Identifier-Character  →  Identifier-Head 
Identifier-Characters  →  Identifier-Character [ Identifier-Characters ] 

Implicit-Parameter-Name  →   "$"  Decimal-Digits 
Property-Wrapper-Projection  →   "$"  Identifier-Characters 

Literal  →  Numeric-Literal | String-Literal | Boolean-Literal | Nil-Literal 

Numeric-Literal  →  [  "-"  ] Integer-Literal | [  "-"  ] Floating-Point-Literal 
Boolean-Literal  →   "true"  |  "false"  
Nil-Literal  →   "nil"  

Integer-Literal  →  Binary-Literal 
Integer-Literal  →  Octal-Literal 
Integer-Literal  →  Decimal-Literal 
Integer-Literal  →  Hexadecimal-Literal 

Binary-Literal  →   "0b"  Binary-Digit [ Binary-Literal-Characters ] 
Binary-Digit  →  Digit 0 or 1 
Binary-Literal-Character  →  Binary-Digit |  "_"  
Binary-Literal-Characters  →  Binary-Literal-Character [ Binary-Literal-Characters ] 

Octal-Literal  →   "0o"  Octal-Digit [ Octal-Literal-Characters ] 
Octal-Digit  →  Digit 0 through 7 
Octal-Literal-Character  →  Octal-Digit |  "_"  
Octal-Literal-Characters  →  Octal-Literal-Character [ Octal-Literal-Characters ] 

Decimal-Literal  →  Decimal-Digit [ Decimal-Literal-Characters ] 
Decimal-Digit  →  Digit 0 through 9 
Decimal-Digits  →  Decimal-Digit [ Decimal-Digits ] 
Decimal-Literal-Character  →  Decimal-Digit |  "_"  
Decimal-Literal-Characters  →  Decimal-Literal-Character [ Decimal-Literal-Characters ] 

Hexadecimal-Literal  →   "0x"  Hexadecimal-Digit [ Hexadecimal-Literal-Characters ] 
Hexadecimal-Digit  →  Digit 0 through 9, a through f, or A through F 
Hexadecimal-Literal-Character  →  Hexadecimal-Digit |  "_"  
Hexadecimal-Literal-Characters  →  Hexadecimal-Literal-Character [ Hexadecimal-Literal-Characters ] 

Floating-Point-Literal  →  Decimal-Literal [ Decimal-Fraction ] [ Decimal-Exponent ] 
Floating-Point-Literal  →  Hexadecimal-Literal [ Hexadecimal-Fraction ] Hexadecimal-Exponent 

Decimal-Fraction  →   "."  Decimal-Literal 
Decimal-Exponent    Floating-Point-E [ Sign ] Decimal-Literal 

Hexadecimal-Fraction     "."  Hexadecimal-Digit [ Hexadecimal-Literal-Characters ] 
Hexadecimal-Exponent    Floating-Point-P [ Sign ] Decimal-Literal 

Floating-Point-E     "e"  |  "E"  
Floating-Point-P     "p"  |  "P"  
Sign     "+"  |  "-"  

String-Literal    Static-String-Literal | Interpolated-String-Literal 

String-Literal-Opening-Delimiter    [ Extended-String-Literal-Delimiter ]  """  
String-Literal-Closing-Delimiter     """  [ Extended-String-Literal-Delimiter ] 

Static-String-Literal    String-Literal-Opening-Delimiter [ Quoted-Text ] String-Literal-Closing-Delimiter 
Static-String-Literal    Multiline-String-Literal-Opening-Delimiter [ Multiline-Quoted-Text ] Multiline-String-Literal-Closing-Delimiter 

Multiline-String-Literal-Opening-Delimiter    Extended-String-Literal-Delimiter  """""  
Multiline-String-Literal-Closing-Delimiter     """""  Extended-String-Literal-Delimiter 
Extended-String-Literal-Delimiter     "#"  [ Extended-String-Literal-Delimiter ] 

Quoted-Text    Quoted-Text-Item [ Quoted-Text ] 
Quoted-Text-Item    Escaped-Character 
Quoted-Text-Item    Any Unicode scalar value except  """  ,  "\"  , U+000A, or U+000D 

Multiline-Quoted-Text    Multiline-Quoted-Text-Item [ Multiline-Quoted-Text ] 
Multiline-Quoted-Text-Item    Escaped-Character 
Multiline-Quoted-Text-Item    Any Unicode scalar value except  "\"  
Multiline-Quoted-Text-Item    Escaped-Newline 

Interpolated-String-Literal    String-Literal-Opening-Delimiter [ Interpolated-Text ] String-Literal-Closing-Delimiter 
Interpolated-String-Literal    Multiline-String-Literal-Opening-Delimiter [ Interpolated-Text ] Multiline-String-Literal-Closing-Delimiter 

Interpolated-Text    Interpolated-Text-Item [ Interpolated-Text ] 
Interpolated-Text-Item     "\("  Expression  ")"  | Quoted-Text-Item 

Multiline-Interpolated-Text    Multiline-Interpolated-Text-Item [ Multiline-Interpolated-Text ] 
Multiline-Interpolated-Text-Item     "\("  Expression  ")"  | Multiline-Quoted-Text-Item 

Escape-Sequence     "\"  Extended-String-Literal-Delimiter 
Escaped-Character    Escape-Sequence  "0"  | Escape-Sequence  "\"  | Escape-Sequence  "t"  | Escape-Sequence  "n"  | Escape-Sequence  "r"  | Escape-Sequence  """  | Escape-Sequence  "'"  
Escaped-Character    Escape-Sequence  "u"   "{"  Unicode-Scalar-Digits  "}"  
Unicode-Scalar-Digits    Between one and eight hexadecimal digits 

Escaped-Newline    Escape-Sequence [ Whitespace ] Line-Break 

Operator    Operator-Head [ Operator-Characters ] 
Operator    Dot-Operator-Head Dot-Operator-Characters 

Operator-Head     "/"  |  "="  |  "-"  |  "+"  |  "!"  |  "*"  |  "%"  |  "<"  |  ">"  |  "&"  |  "|"  |  "^"  |  "~"  |  "?"  
Operator-Head  →  U+00A1–U+00A7 
Operator-Head  →  U+00A9 or U+00AB 
Operator-Head  →  U+00AC or U+00AE 
Operator-Head  →  U+00B0–U+00B1 
Operator-Head  →  U+00B6, U+00BB, U+00BF, U+00D7, or U+00F7 
Operator-Head  →  U+2016–U+2017 
Operator-Head  →  U+2020–U+2027 
Operator-Head  →  U+2030–U+203E 
Operator-Head  →  U+2041–U+2053 
Operator-Head  →  U+2055–U+205E 
Operator-Head  →  U+2190–U+23FF 
Operator-Head  →  U+2500–U+2775 
Operator-Head  →  U+2794–U+2BFF 
Operator-Head  →  U+2E00–U+2E7F 
Operator-Head  →  U+3001–U+3003 
Operator-Head  →  U+3008–U+3020 
Operator-Head  →  U+3030 

Operator-Character  →  Operator-Head 
Operator-Character  →  U+0300–U+036F 
Operator-Character  →  U+1DC0–U+1DFF 
Operator-Character  →  U+20D0–U+20FF 
Operator-Character  →  U+FE00–U+FE0F 
Operator-Character  →  U+FE20–U+FE2F 
Operator-Character  →  U+E0100–U+E01EF 
Operator-Characters  →  Operator-Character [ Operator-Characters ] 

Dot-Operator-Head  →   "."  
Dot-Operator-Character     "."  | Operator-Character 
Dot-Operator-Characters    Dot-Operator-Character [ Dot-Operator-Characters ] 

Binary-Operator    Operator 
Prefix-Operator    Operator 
Postfix-Operator    Operator