-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtypee_specs_LL1-v7.grm
859 lines (617 loc) · 32.3 KB
/
typee_specs_LL1-v7.grm
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
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
/*****
Copyright (c) 2018-2021 Philippe Schmouker, Typee project, http://www.typee.ovh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*****/
/***** CODE FILE ************************************************/
<code file> ::= <statements list> <ENDOFFILE>
/***** ATOMS ****************************************************/
<atom element> ::= <atom>
| <dotted name> <atom element'>
| <const qualifier> <scalar type> <scalar type casting>
| <scalar type> <scalar type casting>
<atom element'> ::= <dotted name'> <atom element'>
| <is instance of>
| <subscription or slicing> <atom element'>
| <function call> <atom element'>
| <scalar type casting>
| EPS
<atom> ::= <decr> <dotted name> <incr or decr>
| <incr> <dotted name> <incr or decr>
| <enclosure>
| <scalar>
| <string>
<bracket form> ::= '[' <expression> <list or map form> ']'
<decr> ::= '--'
<enclosure> ::= <bracket form>
| <parenthesis form>
<incr> ::= '++'
<incr or decr> ::= <decr> | <incr> | EPS
<is instance of> ::= '->' <dotted name>
<list or comprehension> ::= <expr list'>
| <for comprehension>
| EPS
<list or map form> ::= <list form>
| <map form>
<list form> ::= '[' <expression> <list or comprehension> ']'
<parenthesis form> ::= '(' <expr list> ')'
<scalar type casting> ::= '(' <expression> ')'
<slice end> ::= ']'
| ')'
<slice form> ::= ':' <slice upper> <slice step>
<slice step> ::= ':' <slice step'>
| EPS
<slice step'> ::= <expression>
| EPS
<slice upper> ::= <expression>
| EPS
<subscription or slicing> ::= '[' <expression> <subscription or slicing'>
<subscription or slicing'> ::= <expr list'> ']'
| <if comprehension>
| <slice form> <slice end>
/***** CLASSES *******************************************/
<class definition> ::= 'class' <identifier> <template def> <inheritance> <statements block>
<inheritance> ::= ':' <inheritance item> <inheritance'>
| EPS
<inheritance'> ::= ',' <inheritence item> <inheritance'>
| EPS
<inheritance item> ::= <access qualifier> <inheritance item'>
| <inheritance item'>
<inheritance item'> ::= <dotted name> <template args>
/***** COMPREHENSION ********************************************/
<for comprehension> ::= 'for' '(' <target list> 'in' <or test> <iter comprehension> ')'
<if comprehension> ::= 'if' '(' <condition or unnamed func> ')' <iter comprehension>
<iter comprehension> ::= <for comprehension>
| <if comprehension>
| EPS
/***** CONDITIONS and COMPARISONS *******************************/
<condition> ::= <or test> <condition'>
<condition'> ::= 'if' <or test> 'else' <expression>
| EPS
<and test> ::= <not test> <and test'>
<and test'> ::= 'and' <not test>
| EPS
<comparison> ::= <bitor expr> <comparison'>
<comparison'> ::= <comp operator> <template args> <bitor expr> <comparison'>
| <comp operator'> <spaced template args> <bitor expr> <comparison'>
| EPS
<comp operator> ::= '<=' | '==' | '!=' | '>='
| 'in'
| <is operator>
| 'not' 'in'
<comp operator'> ::= '<' | '>'
<condition or unnamed func> ::= <or test>
| <unnamed function>
<is operator> ::= 'is' <is operator'>
<is operator'> ::= 'not'
| EPS
<not test> ::= 'not' <not test>
| <comparison>
<or test> ::= <and test> <or test'>
<or test'> ::= 'or' <and test>
| EPS
/***** EXPRESSIONS **********************************************/
<expression> ::= <condition>
| <unnamed func>
<arithmetic expr> ::= <term> <arithmetic expr'>
<artihmetic expr'> ::= '+' <template args> <term> <arithmetic expr'>
| '-' <template args> <term> <arithmetic expr'>
| EPS
<expr list> ::= <expression> <expr list'>
<expr list'> ::= ',' <expression> <expr list'>
| EPS
<factor> ::= <atom element> <factor'>
<factor'> ::= '**' <template args> <unary expr>
| '^^' <template args> <unary expr>
| EPS
<identifier> ::= '_' <identifier'>
| <alpha char> <identifier'>
<identifier'> ::= <alpha num char> <identifier'>
| '_' <identifier'>
| EPS
<map form> ::= ':' <expression> <map list or comprehension>
<map item> ::= <expression> ':' <expression>
<map list> ::= ',' <map item> <map list>
| EPS
<map list or comprehension> ::= ',' <map item> <map list>
| <for comprehension>
<bitand expr> ::= <shift expr> <bitand expr'>
<bitand expr'> ::= '&' <template args> <shift expr> <bitand expr'>
| EPS
<bitor expr> ::= <bitxor expr> <bitor expr'>
<bitor expr'> ::= '|' <template args> <bitxor expr> <bitor expr'>
| EPS
<bitxor expr> ::= <bitand expr> <bitxor expr'>
<bitxor expr'> ::= '^' <template args> <bitand expr> <bitxor expr'>
| EPS
<shift expr> ::= <arithmetic expr> <shift expr'>
<shift expr'> ::= '<<' <spaced template args> <arithmetic expr> <shift expr'>
| '>>' <template args> <arithmetic expr> <shift expr'>
| '<<<' <spaced template args> <arithmetic expr> <shift expr'>
| '>>>' <template args> <arithmetic expr> <shift expr'>
| EPS
<term> ::= <factor> <term'>
<term'> ::= '*' <template args> <factor> <term'>
| '/' <template args> <factor> <term'>
| '%' <template args> <factor> <term'>
| '@' <template args> <factor> <term'>
| '><' <spaced template args> <factor> <term'>
| '!!' <template args> <factor> <term'>
| '::' <template args> <factor> <term'>
| EPS
<unary expr> ::= <factor>
| '+' <factor>
| '-' <factor>
| '~' <factor>
| '#' <factor>
/***** FUNCTIONS ************************************************/
<function definition> ::= <template def> <function definition'>
| <function definition'>
<function definition'> ::= <function args declaration> <statements block>
<abstract or final qualif> ::= <abstract qualifier>
| <final qualifier>
| EPS
<abstract qualifier> ::= 'abstract'
<call operator> ::= '(' ')'
<final qualifier> ::= 'final'
<function args declaration> ::= '(' <typed args list> ')'
<function call> ::= <template args> '(' <function call args> ')'
<function call args> ::= <expression> <function call args'>
| EPS
<function call args'> ::= ',' <function call args">
| <for comprehension>
| EPS
<function call args"> ::= <expression> <function call args'>
| <ellipsis> <identifier>
<operator> ::= '<=' | '==' | '!=' | '>='
| '+' | '-' | '*' | '/' | '%' | '**' | '^^'
| '&' | '|' | '^'
| '@' | '><' | '!!' | '::' | '??' ## --
| '++' | '--' | '#'
| 'in'
| <assign op>
| <cast op>
<operator'> ::= '<' | '>' | '<<' | '<<<' | '>>' | '>>>'
<operator definition> ::= 'operator' <operator definition'>
<operator definition'> ::= <operator> <template def> <function args declaration> <statements block>
| <operator'> <spaced template def> <function args declaration> <statements block>
| <call operator> <template def> <statements block>
<typed args list> ::= <TYPE> <identifier> <typed args list'>
| EPS
<typed args list'> ::= ',' <TYPE> <identifier> <typed args list'>
| EPS
<unnamed> ::= 'unnamed'
| 'lambda'
<unnamed func> ::= <unnamed> <TYPE> <function args declaration> <statements block>
/***** MISC *****************************************************/
<alpha char> ::= 'A'...'Z'
| 'a'...'z'
<alpha num char> ::= <alpha char>
| <num char>
<any string quote char> ::= u0x0000...u0xFFFF - ["'", "\\", "\n", "\r", "\f", u0x00]
<any string doublequote char> ::= u0x0000...u0xFFFF - ['"', '\\', '\n', '\r', '\f', u0x00]
<any escaped char> ::= '\\' u0x0000...u0xFFFF - ['\n', '\r', '\f', u0x00]
<any non newline char> ::= u0x0000...u0xFFFF - ['\n', '\r', '\f']
<any non star char> ::= u0x0000...u0xFFFF - ['*']
<any embedded code char> ::= u0x0000...u0xFFFF - ['}']
<binary char> ::= '0'
| '1'
<ellipsis> ::= '...'
<end line> ::= <NEWLINE>
| <ENDOFFILE>
<ENDOFFILE> ::= u0x00
<escaped char> ::= '\\' <escaped char'>
<escaped char'> ::= <alpha char>
| '0' <escaped char">
<escaped char"> ::= 'x' <hexa char> <hexa char> <hexa char> <hexa char>
| 'X' <hexa char> <hexa char> <hexa char> <hexa char>
| <octal char> <octal char>
<FALSE> ::= 'False'
| 'false'
<hexa char> ::= <num char>
| 'A'...'F'
| 'a'...'f'
<ME> ::= 'me'
<NEWLINE> ::= '\n' | '\r' | '\f'
<NONE> ::= 'None'
| 'none'
<num char> ::= '0'...'9'
<octal char> ::= '0'...'7'
<TRUE> ::= 'True'
| 'true'
/***** SCALARS **************************************************/
<scalar> ::= <decimal number>
| <octal hexa binary number>
<binary number> ::= <binary char> <binary number'>
| '_' <binary char> <binary number'>
<binary number'> ::= <binary char> <binary number'>
| '_' <binary char> <binary number'>
| EPS
<decimal number> ::= '1'...'9' <decimal number'>
<decimal number'> ::= <num char> <decimal number'>
| '_' <num char> <decimal number'>
| <fraction part> <exponent part>
| EPS
<decimal part> ::= <num char> <decimal part'>
<decimal part'> ::= <num char> <decimal part'>
| '_' <num char> <decimal part'>
| EPS
<exponent part> ::= 'e' <exponent part'>
| 'E' <exponent part'>
| EPS
<exponent part'> ::= '+' <decimal part>
| '-' <decimal part>
| <decimal part>
<fraction part> ::= '.' <fraction part'>
| EPS
<fraction part'> ::= <decimal part>
| EPS
<hexadecimal number> ::= <hexa char> <hexadecimal number'>
| '_' <hexa char> <hexadecimal number'>
<hexadecimal number'> ::= <hexa char> <hexadecimal number'>
| '_' <hexa char> <hexadecimal number'>
| EPS
<integer number> ::= <decimal number>
| <octal hexa binary number>
<octal hexa binary number> ::= '0' <octal hexa binary>
<octal hexa binary> ::= <octal number>
| 'b' <binary number>
| 'B' <binary number>
| 'x' <hexadecimal number>
| 'X' <hexadecimal number>
<octal number> ::= <octal char> <octal number'>
| '_' <octal char> <octal number'>
| EPS
<octal number'> ::= <octal char> <octal number'>
| '_' <octal char> <octal number'>
| EPS
/***** STATEMENTS ****************************************/
<statements list> ::= <empty statement> <statements list>
| <compound statement> <statements list>
| <simple statement> <statements list>
| <statements block> <statements list>
| EPS
<compound statement> ::= <assign decl def func-call statement>
| <embed statement>
| <for statement>
| <forever statement>
| <if statement>
| <repeat statement>
| <switch statement>
| <try statement>
| <while statement>
| <with statement>
<empty statement> ::= <comment>
| <NEWLINE>
<simple statement> ::= <assert statement> <simple statement end>
| <del statement> <simple statement end>
| <ensure statement> <simple statement end>
| <flow statement> <simple statement end>
| <import statement> <simple statement end>
| <nop statement> <simple statement end>
| <access protection statement> <simple statement end>
| <raise statement> <simple statement end>
| <require statement> <simple statement end>
<simple statement end> ::= ';'
<statements block> ::= '{' <statements list> '}'
| <nop statement> <simple statement end>
| <simple statement end>
<assert statement> ::= 'assert' <expression> <assert statement'>
<assert statement'> ::= ',' <expression>
| EPS
<assign decl def func-call statement> ::= <access qualifier> <decl or def statement>
| <decl or def statement>
| <dotted name> <assign or func-call statement> <simple statement end>
<access qualifier> ::= 'hidden'
| 'local'
| 'private'
| 'protected'
| 'public'
<access protection statement> ::= ':' <access qualifier> ':'
<assign op> ::= '='
| <augmented assign op>
<assign or func-call statement> ::= <target list'> <assignment statement>
| <function call>
<assignment statement> ::= <assign op> <expr list>
<augmented assign op> ::= '+='
| '-='
| '*='
| '/='
| '%='
| '&='
| '|='
| '^='
| '<<='
| '<<<='
| '>>='
| '>>>='
| '**='
| '^^='
| '@='
| '><='
| '!!='
| '::='
| '??=' ## --
<case> ::= 'case' <expr list> <statements block>
<cast op> ::= 'cast' <identifier>
<comment> ::= '//' <comment'>
| '/*' <multi lines comment>
<comment'> ::= <any non newline char> <comment'>
| <end line>
| <ENDOFFILE>
<decl constructor or decl end> ::= <dotted name'> <decl or def statement'''> ## -- end of declaration statement
| <function definition'> ## -- definition of constructor !
<decl or def statement> ::= <static qualifier> <decl or def statement'>
| <class definition>
| <decl or def statement'>
<decl or def statement'> ::= <abstract qualifier> <method or operator definition>
| <final qualifier> <method or operator definition>
| <volatile qualifier> <type> <identifier> <memory address> <simple statement end>
| <type alias> <simple statement end>
| <decl or def statement''>
<decl or def statement''> ::= <TYPE'> <decl or def statement'''> ## --
| <identifier> <decl constructor or decl end> ## --
<decl or def statement'''> ::= <identifier> <decl or def statement''''>
| <operator definition>
<decl or def statement''''> ::= <function definition>
| <var declaration or assignment> <simple statement end>
<declaration or definition statement> ::= '=' <expression> <declaration statement>
| '<' <types list> '>' <function args declaration>
| <declaration statement>
| <function args declaration>
<declaration statement> ::= ',' <identifier> <declaration statement'>
| EPS
<declaration statement'> ::= '=' <expression> <declaration statement>
| <declaration statement>
<del statement> ::= 'del' <identifiers list>
<dotted as name> ::= <dotted name> <dotted as name'>
<dotted as name'> ::= 'as' <identifier>
| EPS
<dotted as names> ::= <dotted as name> <dotted as names'>
<dotted as names'> ::= ',' <dotted as name> <dotted as names'>
| EPS
<dotted name> ::= <identifier> <dotted name'>
<dotted name'> ::= '.' <identifier> <dotted name'>
| EPS
<embed statement> ::= 'embed' <language> <embed statement'>
<embed statement'> ::= <dotted name> ';'
| <embedded language code>
<embedded language code> ::= '{{' <embedded language code'>
<embeded language code'> ::= <any embedded code char> <embeded language code'>
| '}' <embedded language code">
<embedded language code"> ::= <any embedded code char> <embeded language code'>
| '}'
<ensure statement> ::= 'ensure' <expression> <ensure statement'>
<ensure statement'> ::= ',' <expression>
| EPS
<flow statement> ::= 'break'
| 'continue'
| <raise statement>
| <return statement>
<for statement> ::= 'for' '(' <target list> 'in' <expr list> ')' <statements list> <for statement'> ## --
<for statement'> ::= 'else' <statements list> ## --
| EPS
<forever statement> ::= 'forever' '(' ')' <statements list> ## --
<identifiers list> ::= <dotted name> <identifiers list'>
<identifiers list'> ::= ',' <dotted name> <identifiers list'>
| EPS
<if statement> ::= 'if' '(' <expression> ')' <statements list> <if statement'> ## --
<if statement'> ::= 'elseif' '(' <expression> ')' <statements list> <if statement'> ## --
| 'elif' '(' <expression> ')' <statements list> <if statement'> ## --
| 'elsif' '(' <expression> ')' <statements list> <if statement'> ## --
| 'else' <statements block> ## --
| EPS ## --
## | <if statement"> ## --
##<if statement"> ::= 'else' <statements block> ## --
## | EPS ## --
<import as name> ::= <identifier> <import as name'>
<import as name'> ::= 'as' <identifier>
| EPS
<import as names> ::= <import as name> <import as names'>
<import as names'> ::= ',' <import as name> <import as names'>
| EPS
<import from> ::= 'from' <import from'>
<import from'> ::= '.' <import from'>
| <import from''>
<import from'' ::= <dotted name> 'import' <import from'''>
<import from'''> ::= 'all'
| '(' <import as names> ')'
| <import as names>
<import name> ::= 'import' <dotted as names>
<import statement> ::= <import name>
| <import from>
<language> ::= 'cpp' | 'java' | 'python' | 'py' | 'javascript' | 'm6809'
<memory address> ::= '@' <integer number>
| EPS ## --
<method or operator definition> ::= <TYPE> <method or operator definition'>
<method or operator definition'> ::= <operator definition>
| <identifier> <function definition>
<multi lines comment> ::= '*' <multi lines comment'>
| <any non star char> <multi lines comment>
| <NEWLINE> <multi lines comment>
| EPS
<multi lines comment'> ::= '/'
| <multi lines comment>
<nop statement> ::= 'nop'
| 'pass'
<raise statement> ::= 'raise' <expression> <raise statement'>
<raise statement'> ::= 'from' <expression>
| EPS
<repeat statement> ::= 'repeat' <statements list> 'until' '(' <expression> ')' ';'
<require statement> ::= 'require' <expression> <require statement'>
<require statement'> ::= ',' <expression>
| EPS
<return statement> ::= 'ret' <return statement'>
| 'return' <return statement'>
<return statement'> ::= <expr list>
| EPS
<switch block> ::= <case> <switch block>
| EPS
<switch statement> ::= 'switch' '(' <expression> ')' '{' <switch block> '}' <switch statement'>
<switch statement'> ::= 'else' <statements list> ## --
| EPS
<target> ::= <dotted name> <target'>
<target'> ::= <subscription or slicing> <target'>
| EPS
<target list> ::= <typed target> <target list'>
<target list'> ::= ',' <typed target> <target list'>
| EPS
<try else> ::= 'else'
<try finally> ::= 'finally'
<try except> ::= 'except' '(' <try except'> ')'
<try except'> ::= <expression> <try except">
| 'all'
| EPS
<try except"> ::= 'as' <identifier>
| EPS
<try statement> ::= 'try' <statements list> <try statement'> ## --
<try statement'> ::= <try else> <statements list> <try statement"> ## --
| <try except> <statements list> <try statement'> ## --
| EPS
<try statement"> ::= <try finally> <statements list> ## --
| EPS
<type alias> ::= 'type' <TYPE> 'as' <identifier> <type alias'>
<type alias'> ::= ',' <TYPE> 'as' <identifier> <type alias'>
| EPS
<typed target> ::= <type'> <target>
| <dotted name> <typed target'>
<typed target'> ::= <dotted name> <target'>
| <target'>
| <templated type'> <target'>
<var declaration or assignment> ::= '=' <expression> <var declaration or assignment'>
| ',' <identifier> <var declaration or assignment>
| EPS
<var declaration or assignment'> ::= ',' <identifier> <var declaration or assignment>
| EPS
<while statement> ::= 'while' '(' <expression> ')' <statements list> <while statement'> ## --
<while statement'> ::= 'else' <statements list> ## --
| EPS
<with item> ::= <expression> <with item'>
<with item'> ::= 'as' <target>
| EPS
<with items list> ::= <with item> <with items list'>
<with items list'> ::= ',' <with item> <with items list'>
| EPS
<with statement> ::= 'with' <with items list> <statements list> ## --
/***** STRINGS **************************************************/
<string> ::= <single string> <string'> <string methods> ## --
<string'> ::= <single string> <string'>
| EPS
<string methods> ::= '.' <identifier> <function call> <string methods'> ## --
| EPS ## --
<string methods'> ::= '.' <identifier> <function call> <string methods'> ## --
| EPS ## --
<single string> ::= "'" <single string'> "'"
| '"' <single string"> '"'
<single string'> ::= <any escaped char> <single string'>
| <any string quote char> <single string'>
| EPS
<single string"> ::= <any escaped char> <single string">
| <any string doublequote char> <single string">
| EPS
/***** TEMPLATES *****************************************/
<spaced template args> ::= ' <' <template args'> '>'
| EPS
<spaced template def> ::= ' <' <template def'> '>'
| EPS
<template args> ::= '<' <template args'>
| EPS
<template args'> ::= <condition> <template args">
| '>'
<template args"> ::= ',' <condition> <template args">
| '>'
<template def> ::= '<' <template def'>
| EPS
<template def'> ::= <template def''> <template def'''>
| '>'
<template def''> ::= <identifier>
| <const qualifier> <template def const name>
<template def'''> ::= ',' <template def''> <template def'''>
| '>'
<template def const name> ::= <scalar type or dotted name> <identifier> <template def const name'>
<template def const name'> ::= '=' <expression>
| EPS
/***** TYPES ****************************************************/
<TYPE> ::= <const qualifier> <type>
| <type>
<TYPE'> ::= <const qualifier> <type> ## --
| <type'> ## --
<type> ::= <type'>
| <templated type> <dimensions>
<type'> ::= <auto type>
| '(' <types list> ')'
| <container type>
| <file>
| <NONE>
| <scalar type> <dimensions>
<array type> ::= 'array' <declared contained type>
<auto type> ::= '?' <auto type'>
<auto type'> ::= 'in' '(' <types list> ')'
| EPS
<const qualifier> ::= 'const'
<container type> ::= <array_type>
| <enum type>
| <list type>
| <map type>
| <set type>
<declared contained type> ::= '<' <TYPE> '>'
<dimensions> ::= '[' <dimensions'> ']' <dimensions>
| EPS
<dimensions'> ::= <integer number>
| <dotted name>
<scalar type or dotted name> ::= <scalar type>
| <dotted name>
<enum type> ::= 'enum'
<file> ::= 'file' <file'>
<file'> ::= <declared contained type>
| EPS
<list type> ::= 'list' <list type'>
<list type'> ::= <declared contained type>
| EPS
<map type> ::= 'map' <map type'>
<map type'> ::= <declared contained type>
| EPS
<scalar type> ::= 'bool'
| 'char'
| 'char16'
| 'float32'
| 'float64'
| 'int8'
| 'int16'
| 'int32'
| 'int64'
| 'str'
| 'str16'
| 'uint8'
| 'uint16'
| 'uint32'
| 'uint64'
<set type> ::= 'set' <declared contained type>
<static qualifier> ::= 'static'
<templated type> ::= <dotted name> <templated type'>
<templated type'> ::= '<' <types and exprs list> '>'
| EPS
<types and exprs list> ::= <expression> <types and exprs list'>
| <templated type> <types and exprs list'>
<types and exprs list'> ::= ',' <types and exprs list"> <types and exprs list'>
| EPS
<types and exprs list"> ::= <expression>
| <templated type>
<types list> ::= <TYPE> <types list'>
<types list'> ::= ',' <TYPE> <types list'>
| EPS
<volatile qualifier> ::= 'volatile'
/*================================================================================================*/