-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtree-sitter-fortran.ebnf
754 lines (556 loc) · 25.4 KB
/
tree-sitter-fortran.ebnf
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
//
// From tree-sitter-fortran/src/grammar.json
//
//
// EBNF to generate railroad diagram at
// (IPV6) https://www.bottlecaps.de/rr/ui
// (IPV4) https://rr.red-dove.com/ui
//
translation_unit ::=
_top_level_item* program?
_top_level_item ::=
include_statement _end_of_statement | program | module | submodule | interface | subroutine | function
program ::=
program_statement? _specification_part* _statement* internal_procedures? end_program_statement
program_statement ::=
[pP][rR][oO][gG][rR][aA][mM] _name
end_program_statement ::=
( [eE][nN][dD] [pP][rR][oO][gG][rR][aA][mM]? | [eE][nN][dD][pP][rR][oO][gG][rR][aA][mM] ) _name? _end_of_statement
module ::=
module_statement _specification_part* internal_procedures? end_module_statement
module_statement ::=
[mM][oO][dD][uU][lL][eE] _name
end_module_statement ::=
( [eE][nN][dD] [mM][oO][dD][uU][lL][eE]? | [eE][nN][dD][mM][oO][dD][uU][lL][eE] ) _name? _end_of_statement
submodule ::=
submodule_statement _specification_part* internal_procedures? end_submodule_statement
submodule_statement ::=
[sS][uU][bB][mM][oO][dD][uU][lL][eE] '(' module_name ( ':' module_name )? ')' _name
end_submodule_statement ::=
( [eE][nN][dD] [sS][uU][bB][mM][oO][dD][uU][lL][eE]? | [eE][nN][dD][sS][uU][bB][mM][oO][dD][uU][lL][eE] ) _name? _end_of_statement
module_name ::=
_name
interface ::=
interface_statement ( import_statement | procedure_statement | function | subroutine )* end_interface_statement
interface_statement ::=
abstract_specifier? [iI][nN][tT][eE][rR][fF][aA][cC][eE] ( _name | _generic_procedure )?
end_interface_statement ::=
( [eE][nN][dD] [iI][nN][tT][eE][rR][fF][aA][cC][eE] | [eE][nN][dD][iI][nN][tT][eE][rR][fF][aA][cC][eE] ) ( _name | _generic_procedure )? _end_of_statement
assignment ::=
[aA][sS][sS][iI][gG][nN][mM][eE][nN][tT] '(' '=' ')'
operator ::=
[oO][pP][eE][rR][aA][tT][oO][rR] '(' [^()]+ ')'
defined_io_procedure ::=
( [rR][eE][aA][dD] | [wW][rR][iI][tT][eE] ) '(' ( [fF][oO][rR][mM][aA][tT][tT][eE][dD] | [uU][nN][fF][oO][rR][mM][aA][tT][tT][eE][dD] ) ')'
_generic_procedure ::=
assignment
| operator
| defined_io_procedure
subroutine ::=
subroutine_statement _end_of_statement _specification_part* _statement* internal_procedures? end_subroutine_statement
subroutine_statement ::=
_callable_interface_qualifers? [sS][uU][bB][rR][oO][uU][tT][iI][nN][eE] _name _parameters? language_binding?
end_subroutine_statement ::=
( [eE][nN][dD] [sS][uU][bB][rR][oO][uU][tT][iI][nN][eE]? | [eE][nN][dD][sS][uU][bB][rR][oO][uU][tT][iI][nN][eE] ) _name? _end_of_statement
module_procedure ::=
module_procedure_statement _end_of_statement _specification_part* _statement* internal_procedures? end_module_procedure_statement
module_procedure_statement ::=
_callable_interface_qualifers? [mM][oO][dD][uU][lL][eE] [pP][rR][oO][cC][eE][dD][uU][rR][eE] _name
end_module_procedure_statement ::=
( [eE][nN][dD] [pP][rR][oO][cC][eE][dD][uU][rR][eE]? | [eE][nN][dD][pP][rR][oO][cC][eE][dD][uU][rR][eE] ) _name? _end_of_statement
function ::=
function_statement _end_of_statement _specification_part* _statement* internal_procedures? end_function_statement
function_statement ::=
_callable_interface_qualifers? [fF][uU][nN][cC][tT][iI][oO][nN] _name _parameters? ( language_binding | function_result )*?
language_binding ::=
[bB][iI][nN][dD] '(' identifier ( ',' keyword_argument )? ')'
_callable_interface_qualifers ::=
procedure_attributes | procedure_qualifier | _intrinsic_type | derived_type+
procedure_attributes ::=
[aA][tT][tT][rR][iI][bB][uU][tT][eE][sS] '(' ( [gG][lL][oO][bB][aA][lL] | [dD][eE][vV][iI][cC][eE] | [hH][oO][sS][tT] | [gG][rR][iI][dD]'_'[gG][lL][oO][bB][aA][lL] ) ( ',' ( [gG][lL][oO][bB][aA][lL] | [dD][eE][vV][iI][cC][eE] | [hH][oO][sS][tT] | [gG][rR][iI][dD]'_'[gG][lL][oO][bB][aA][lL] ) )* ')'
end_function_statement ::=
( [eE][nN][dD] [fF][uU][nN][cC][tT][iI][oO][nN]? | [eE][nN][dD][fF][uU][nN][cC][tT][iI][oO][nN] ) _name? _end_of_statement
function_result ::=
[rR][eE][sS][uU][lL][tT] '(' identifier ')'
_name ::=
identifier
_parameters ::=
'(' ')'
| parameters
parameters ::=
'(' identifier ( ',' identifier )* ')'
internal_procedures ::=
contains_statement _end_of_statement ( function | module_procedure | subroutine )*
contains_statement ::=
[cC][oO][nN][tT][aA][iI][nN][sS]
_specification_part ::=
include_statement _end_of_statement | use_statement _end_of_statement | implicit_statement _end_of_statement | save_statement _end_of_statement | import_statement _end_of_statement | public_statement _end_of_statement | private_statement _end_of_statement | enum | interface | derived_type_definition | namelist_statement _end_of_statement | common_statement _end_of_statement | variable_declaration _end_of_statement | variable_modification _end_of_statement | parameter_statement _end_of_statement | equivalence_statement _end_of_statement | data_statement _end_of_statement | statement_label format_statement _end_of_statement
use_statement ::=
[uU][sS][eE] ( ',' ( [iI][nN][tT][rR][iI][nN][sS][iI][cC] | [nN][oO][nN]'_'[iI][nN][tT][rR][iI][nN][sS][iI][cC] ) '::' | '::' ) identifier ( ',' use_alias ( ',' use_alias )* | included_items )?
included_items ::=
',' [oO][nN][lL][yY] ':' ( ( use_alias | identifier | _generic_procedure ) ( ',' ( use_alias | identifier | _generic_procedure ) )* )?
use_alias ::=
identifier '=>' identifier
implicit_statement ::=
[iI][mM][pP][lL][iI][cC][iI][tT] ( intrinsic_type size? '(' implicit_range ( ',' implicit_range )* ')' ( ',' intrinsic_type size? '(' implicit_range ( ',' implicit_range )* ')' )* | [nN][oO][nN][eE] ( '(' ( [tT][yY][pP][eE] | [eE][xX][tT][eE][rR][nN][aA][lL] ) ( ',' ( [tT][yY][pP][eE] | [eE][xX][tT][eE][rR][nN][aA][lL] ) )* ')' )? )
save_statement ::=
[sS][aA][vV][eE] ( '::'? ( identifier | '/' identifier '/' ) ( ',' ( identifier | '/' identifier '/' ) )* )?
private_statement ::=
[pP][rR][iI][vV][aA][tT][eE] ( '::' ( identifier | _generic_procedure ) ( ',' ( identifier | _generic_procedure ) )* )?
public_statement ::=
[pP][uU][bB][lL][iI][cC] ( '::' ( identifier | _generic_procedure ) ( ',' ( identifier | _generic_procedure ) )* )?
namelist_statement ::=
[nN][aA][mM][eE][lL][iI][sS][tT] variable_group+
common_statement ::=
[cC][oO][mM][mM][oO][nN] ( variable_group | identifier ( ',' identifier )* )+
variable_group ::=
'/' _name '/' identifier ( ',' identifier )*
implicit_range ::=
[a-zA-Z] ( '-' [a-zA-Z] )?
import_statement ::=
[iI][mM][pP][oO][rR][tT] _import_names?
_import_names ::=
'::'? identifier ( ',' identifier )*
| ',' ( [oO][nN][lL][yY] ':' identifier ( ',' identifier )* | [nN][oO][nN][eE] | [aA][lL][lL] )
derived_type_definition ::=
derived_type_statement public_statement? private_statement? ( [sS][eE][qQ][uU][eE][nN][cC][eE] _end_of_statement )? ( ( include_statement | variable_declaration ) _end_of_statement )* derived_type_procedures? end_type_statement
abstract_specifier ::=
[aA][bB][sS][tT][rR][aA][cC][tT]
access_specifier ::=
[pP][uU][bB][lL][iI][cC]
| [pP][rR][iI][vV][aA][tT][eE]
base_type_specifier ::=
[eE][xX][tT][eE][nN][dD][sS] '(' identifier ')'
_derived_type_qualifier ::=
abstract_specifier
| access_specifier
| base_type_specifier
| language_binding
derived_type_statement ::=
statement_label? [tT][yY][pP][eE] ( '::'? _type_name | ',' _derived_type_qualifier ( ',' _derived_type_qualifier )* '::' _type_name ) _end_of_statement
end_type_statement ::=
( [eE][nN][dD] [tT][yY][pP][eE]? | [eE][nN][dD][tT][yY][pP][eE] ) _name? _end_of_statement
_type_name ::=
identifier
derived_type_procedures ::=
contains_statement public_statement? private_statement? procedure_statement*
procedure_statement ::=
_procedure_kind ( '(' identifier ')' )? ( ',' procedure_attribute ( ',' procedure_attribute )* )? '::'? ( method_name | binding_name '=>' method_name ) ( ',' ( method_name | binding_name '=>' method_name ) )*
binding_name ::=
identifier
| _generic_procedure
method_name ::=
identifier
_procedure_kind ::=
[gG][eE][nN][eE][rR][iI][cC]
| [iI][nN][iI][tT][iI][aA][lL]
| [pP][rR][oO][cC][eE][dD][uU][rR][eE]
| [mM][oO][dD][uU][lL][eE] [pP][rR][oO][cC][eE][dD][uU][rR][eE]
| [pP][rR][oO][pP][eE][rR][tT][yY]
| [fF][iI][nN][aA][lL]
procedure_attribute ::=
[dD][eE][fF][eE][rR][rR][eE][dD] | [pP][aA][sS][sS] ( '(' identifier ')' )? | [nN][oO][pP][aA][sS][sS] | [nN][oO][nN]'_'[oO][vV][eE][rR][rR][iI][dD][aA][bB][lL][eE] | [pP][uU][bB][lL][iI][cC] | [pP][rR][iI][vV][aA][tT][eE] | [fF][aA][mM][iI][lL][yY] | [pP][oO][iI][nN][tT][eE][rR]
variable_declaration ::=
( _intrinsic_type | derived_type | procedure_declaration ) ( ',' type_qualifier ( ',' type_qualifier )* )? '::'? _declaration_targets
procedure_declaration ::=
[pP][rR][oO][cC][eE][dD][uU][rR][eE] ( '(' identifier? ')' )? ( ',' procedure_attribute ( ',' procedure_attribute )* )?
variable_modification ::=
( type_qualifier | variable_attributes )+ '::'? _declaration_targets
variable_attributes ::=
[aA][tT][tT][rR][iI][bB][uU][tT][eE][sS] '(' ( [dD][eE][vV][iI][cC][eE] | [mM][aA][nN][aA][gG][eE][dD] | [cC][oO][nN][sS][tT][aA][nN][tT] | [sS][hH][aA][rR][eE][dD] | [pP][iI][nN][nN][eE][dD] | [tT][eE][xX][tT][uU][rR][eE] ) ')'
_declaration_targets ::=
( identifier | identifier character_length | call_expression | assignment_statement | pointer_association_statement ) ( ',' ( identifier | identifier character_length | call_expression | assignment_statement | pointer_association_statement ) )*
_intrinsic_type ::=
intrinsic_type size?
intrinsic_type ::=
[bB][yY][tT][eE]
| [iI][nN][tT][eE][gG][eE][rR]
| [rR][eE][aA][lL]
| ( [dD][oO][uU][bB][lL][eE] [pP][rR][eE][cC][iI][sS][iI][oO][nN] | [dD][oO][uU][bB][lL][eE][pP][rR][eE][cC][iI][sS][iI][oO][nN] )
| [cC][oO][mM][pP][lL][eE][xX]
| ( [dD][oO][uU][bB][lL][eE] [cC][oO][mM][pP][lL][eE][xX] | [dD][oO][uU][bB][lL][eE][cC][oO][mM][pP][lL][eE][xX] )
| [lL][oO][gG][iI][cC][aA][lL]
| [cC][hH][aA][rR][aA][cC][tT][eE][rR]
derived_type ::=
( [tT][yY][pP][eE] | [cC][lL][aA][sS][sS] ) '(' ( _intrinsic_type | _type_name | unlimited_polymorphic ) ')'
unlimited_polymorphic ::=
'*'
size ::=
'*'? argument_list
| '*' ( [0-9]+ | parenthesized_expression )
character_length ::=
'*' [0-9]+? ( '(' '*' ')' )?
type_qualifier ::=
[aA][bB][sS][tT][rR][aA][cC][tT]
| [aA][lL][lL][oO][cC][aA][tT][aA][bB][lL][eE]
| [aA][uU][tT][oO][mM][aA][tT][iI][cC]
| [dD][iI][mM][eE][nN][sS][iI][oO][nN] argument_list?
| [cC][oO][nN][sS][tT][aA][nN][tT]
| [cC][oO][nN][tT][iI][gG][uU][oO][uU][sS]
| [dD][eE][vV][iI][cC][eE]
| [eE][xX][tT][eE][rR][nN][aA][lL]
| [iI][nN][tT][eE][nN][tT] '(' ( [iI][nN] | [oO][uU][tT] | ( [iI][nN] [oO][uU][tT] | [iI][nN][oO][uU][tT] ) ) ')'
| [iI][nN][tT][rR][iI][nN][sS][iI][cC]
| [mM][aA][nN][aA][gG][eE][dD]
| [oO][pP][tT][iI][oO][nN][aA][lL]
| [pP][aA][rR][aA][mM][eE][tT][eE][rR]
| [pP][iI][nN][nN][eE][dD]
| [pP][oO][iI][nN][tT][eE][rR]
| [pP][rR][iI][vV][aA][tT][eE]
| [pP][rR][oO][tT][eE][cC][tT][eE][dD]
| [pP][uU][bB][lL][iI][cC]
| [sS][aA][vV][eE]
| [sS][eE][qQ][uU][eE][nN][cC][eE]
| [sS][hH][aA][rR][eE][dD]
| [sS][tT][aA][tT][iI][cC]
| [tT][aA][rR][gG][eE][tT]
| [tT][eE][xX][tT][uU][rR][eE]
| [vV][aA][lL][uU][eE]
| [vV][oO][lL][aA][tT][iI][lL][eE]
procedure_qualifier ::=
[eE][lL][eE][mM][eE][nN][tT][aA][lL]
| [iI][mM][pP][uU][rR][eE]
| [mM][oO][dD][uU][lL][eE]
| [pP][uU][rR][eE]
| [rR][eE][cC][uU][rR][sS][iI][vV][eE]
parameter_statement ::=
[pP][aA][rR][aA][mM][eE][tT][eE][rR] '(' parameter_assignment ( ',' parameter_assignment )* ')'
parameter_assignment ::=
identifier '=' _expression
equivalence_statement ::=
[eE][qQ][uU][iI][vV][aA][lL][eE][nN][cC][eE] equivalence_set ( ',' equivalence_set )*
equivalence_set ::=
'(' ( identifier | call_expression ) ',' ( identifier | call_expression ) ( ',' ( identifier | call_expression ) )* ')'
_statement ::=
statement_label? _statements _end_of_statement
_statements ::=
assignment_statement
| pointer_association_statement
| call_expression
| subroutine_call
| keyword_statement
| include_statement
| if_statement
| arithmetic_if_statement
| where_statement
| forall_statement
| select_case_statement
| select_type_statement
| select_rank_statement
| do_loop_statement
| do_label_statement
| format_statement
| open_statement
| close_statement
| print_statement
| write_statement
| read_statement
| inquire_statement
| stop_statement
| block_construct
| associate_statement
| file_position_statement
statement_label ::=
_integer_literal
statement_label_reference ::=
statement_label
stop_statement ::=
[eE][rR][rR][oO][rR]? [sS][tT][oO][pP] _expression? ( ',' [qQ][uU][iI][eE][tT] '=' _expression )?
assignment_statement ::=
_expression '=' _expression
pointer_association_statement ::=
_expression '=>' _expression
subroutine_call ::=
[cC][aA][lL][lL] _expression cuda_kernel_argument_list? argument_list?
cuda_kernel_argument_list ::=
'<<<' _expression ( ',' _expression )* '>>>'
keyword_statement ::=
[cC][oO][nN][tT][iI][nN][uU][eE]
| [cC][yY][cC][lL][eE] identifier?
| [eE][xX][iI][tT] identifier?
| ( [gG][oO] [tT][oO] | [gG][oO][tT][oO] ) ( statement_label_reference | '(' statement_label_reference ( ',' statement_label_reference )* ')' ','? _expression )
| [rR][eE][tT][uU][rR][nN]
include_statement ::=
[iI][nN][cC][lL][uU][dD][eE] string_literal
data_statement ::=
[dD][aA][tT][aA] data_set ( ',' data_set )*
data_set ::=
( identifier | implied_do_loop_expression | call_expression | derived_type_member_expression ) ( ',' ( identifier | implied_do_loop_expression | call_expression | derived_type_member_expression ) )* data_value
data_value ::=
'/' number_literal '*'? ( number_literal | complex_literal | string_literal | boolean_literal | unary_expression | null_literal | identifier | call_expression ) ( ',' number_literal '*'? ( number_literal | complex_literal | string_literal | boolean_literal | unary_expression | null_literal | identifier | call_expression ) )* '/'
do_loop_statement ::=
block_label_start_expression? [dD][oO] ','? ( while_statement | loop_control_expression | concurrent_statement )? _end_of_statement _statement* statement_label? end_do_loop_statement
do_label_statement ::=
[dD][oO] statement_label_reference ','? loop_control_expression
end_do_loop_statement ::=
( [eE][nN][dD] [dD][oO] | [eE][nN][dD][dD][oO] ) _block_label?
while_statement ::=
[wW][hH][iI][lL][eE] parenthesized_expression
concurrent_statement ::=
concurrent_header concurrent_locality*
concurrent_header ::=
[cC][oO][nN][cC][uU][rR][rR][eE][nN][tT] '(' ( _intrinsic_type '::' )? concurrent_control ( ',' concurrent_control )* ( ',' _expression )? ')'
concurrent_control ::=
identifier '=' _expression ':' _expression ( ':' _expression )?
concurrent_locality ::=
( [lL][oO][cC][aA][lL] | [lL][oO][cC][aA][lL]'_'[iI][nN][iI][tT] | [sS][hH][aA][rR][eE][dD] ) '(' identifier ( ',' identifier )* ')'
| [dD][eE][fF][aA][uU][lL][tT] '(' [nN][oO][nN][eE] ')'
if_statement ::=
_inline_if_statement
| _block_if_statement
_inline_if_statement ::=
[iI][fF] parenthesized_expression _statements
arithmetic_if_statement ::=
[iI][fF] parenthesized_expression statement_label_reference ',' statement_label_reference ',' statement_label_reference
_block_if_statement ::=
block_label_start_expression? [iI][fF] parenthesized_expression [tT][hH][eE][nN] _block_label? _end_of_statement _statement* elseif_clause* else_clause? statement_label? end_if_statement
end_if_statement ::=
( [eE][nN][dD] [iI][fF] | [eE][nN][dD][iI][fF] ) _block_label?
elseif_clause ::=
( [eE][lL][sS][eE] [iI][fF] | [eE][lL][sS][eE][iI][fF] ) parenthesized_expression [tT][hH][eE][nN] _block_label? _end_of_statement _statement*
else_clause ::=
[eE][lL][sS][eE] _block_label? _end_of_statement _statement*
where_statement ::=
_inline_where_statement
| _block_where_statement
_inline_where_statement ::=
[wW][hH][eE][rR][eE] parenthesized_expression _statements
_block_where_statement ::=
block_label_start_expression? [wW][hH][eE][rR][eE] parenthesized_expression _end_of_statement _statement* elsewhere_clause* end_where_statement
end_where_statement ::=
( [eE][nN][dD] [wW][hH][eE][rR][eE] | [eE][nN][dD][wW][hH][eE][rR][eE] ) _block_label?
elsewhere_clause ::=
( [eE][lL][sS][eE] [wW][hH][eE][rR][eE] | [eE][lL][sS][eE][wW][hH][eE][rR][eE] ) parenthesized_expression? _block_label? _end_of_statement _statement*
forall_statement ::=
_inline_forall_statement
| _block_forall_statement
triplet_spec ::=
identifier '=' _expression ':' _expression ( ':' _expression )?
_forall_control_expression ::=
[fF][oO][rR][aA][lL][lL] '(' triplet_spec ( ',' triplet_spec )* ( ',' ( logical_expression | relational_expression ) )? ')'
_inline_forall_statement ::=
_forall_control_expression _statements
_block_forall_statement ::=
block_label_start_expression? _forall_control_expression _end_of_statement _statement* statement_label? end_forall_statement
end_forall_statement ::=
( [eE][nN][dD] [fF][oO][rR][aA][lL][lL] | [eE][nN][dD][fF][oO][rR][aA][lL][lL] ) _block_label?
select_case_statement ::=
block_label_start_expression? ( [sS][eE][lL][eE][cC][tT] [cC][aA][sS][eE] | [sS][eE][lL][eE][cC][tT][cC][aA][sS][eE] ) selector _end_of_statement case_statement+ statement_label? end_select_statement
select_type_statement ::=
block_label_start_expression? ( [sS][eE][lL][eE][cC][tT] [tT][yY][pP][eE] | [sS][eE][lL][eE][cC][tT][tT][yY][pP][eE] ) selector _end_of_statement type_statement+ statement_label? end_select_statement
select_rank_statement ::=
block_label_start_expression? ( [sS][eE][lL][eE][cC][tT] [rR][aA][nN][kK] | [sS][eE][lL][eE][cC][tT][rR][aA][nN][kK] ) selector _end_of_statement rank_statement+ statement_label? end_select_statement
end_select_statement ::=
( [eE][nN][dD] [sS][eE][lL][eE][cC][tT] | [eE][nN][dD][sS][eE][lL][eE][cC][tT] ) _block_label?
selector ::=
'(' ( _expression | pointer_association_statement ) ')'
case_statement ::=
[cC][aA][sS][eE] ( '(' case_value_range_list ')' | [dD][eE][fF][aA][uU][lL][tT] ) _block_label? _end_of_statement _statement*
type_statement ::=
( ( ( [tT][yY][pP][eE] [iI][sS] | [tT][yY][pP][eE][iI][sS] ) | ( [cC][lL][aA][sS][sS] [iI][sS] | [cC][lL][aA][sS][sS][iI][sS] ) ) ( '(' ( _intrinsic_type | identifier ) ')' ) | _class_default ) _block_label? _end_of_statement _statement*
_class_default ::=
[cC][lL][aA][sS][sS] [dD][eE][fF][aA][uU][lL][tT]
| [cC][lL][aA][sS][sS][dD][eE][fF][aA][uU][lL][tT]
case_value_range_list ::=
( _expression | extent_specifier ) ( ',' ( _expression | extent_specifier ) )*
rank_statement ::=
[rR][aA][nN][kK] ( '(' case_value_range_list ')' | [dD][eE][fF][aA][uU][lL][tT] ) _block_label? _end_of_statement _statement*
block_construct ::=
block_label_start_expression? [bB][lL][oO][cC][kK] _end_of_statement _specification_part* _statement* end_block_construct_statement
end_block_construct_statement ::=
( [eE][nN][dD] [bB][lL][oO][cC][kK] | [eE][nN][dD][bB][lL][oO][cC][kK] ) _block_label?
associate_statement ::=
block_label_start_expression? [aA][sS][sS][oO][cC][iI][aA][tT][eE] '(' association ( ',' association )* ')' _end_of_statement _statement* end_associate_statement
association ::=
identifier '=>' _expression
end_associate_statement ::=
( [eE][nN][dD] [aA][sS][sS][oO][cC][iI][aA][tT][eE] | [eE][nN][dD][aA][sS][sS][oO][cC][iI][aA][tT][eE] ) _block_label?
format_statement ::=
[fF][oO][rR][mM][aA][tT] '(' _transfer_items ')'
_transfer_item ::=
string_literal
| edit_descriptor
| hollerith_constant
| '(' _transfer_items ')'
_transfer_items ::=
_transfer_item ( ','? _transfer_item )*
edit_descriptor ::=
[a-gi-zA-GI-Z0-9/:.*$]+
hollerith_constant ::=
[0-9]+'H'[^/,)]+
_io_arguments ::=
'(' ( unit_identifier | unit_identifier ',' format_identifier | unit_identifier ',' format_identifier ',' keyword_argument ( ',' keyword_argument )* | unit_identifier ',' keyword_argument ( ',' keyword_argument )* | keyword_argument ( ',' keyword_argument )* ) ')'
read_statement ::=
_simple_read_statement | _parameterized_read_statement
_simple_read_statement ::=
[rR][eE][aA][dD] format_identifier ( ',' input_item_list )?
_parameterized_read_statement ::=
[rR][eE][aA][dD] _io_arguments input_item_list?
print_statement ::=
[pP][rR][iI][nN][tT] format_identifier ( ',' output_item_list )?
open_statement ::=
[oO][pP][eE][nN] _io_arguments output_item_list?
close_statement ::=
[cC][lL][oO][sS][eE] '(' ( unit_identifier | unit_identifier ',' keyword_argument ( ',' keyword_argument )* | keyword_argument ( ',' keyword_argument )* ) ')'
write_statement ::=
[wW][rR][iI][tT][eE] _io_arguments ','? output_item_list?
inquire_statement ::=
[iI][nN][qQ][uU][iI][rR][eE] _io_arguments output_item_list?
enum ::=
enum_statement enumerator_statement* end_enum_statement _end_of_statement
enum_statement ::=
[eE][nN][uU][mM] ',' language_binding
enumerator_statement ::=
[eE][nN][uU][mM][eE][rR][aA][tT][oO][rR] '::'? ( identifier | identifier '=' ( number_literal | unary_expression ) ) ( ',' ( identifier | identifier '=' ( number_literal | unary_expression ) ) )*
end_enum_statement ::=
( [eE][nN][dD] [eE][nN][uU][mM] | [eE][nN][dD][eE][nN][uU][mM] )
unit_identifier ::=
number_literal | _io_expressions
format_identifier ::=
statement_label_reference
| _io_expressions
_file_position_spec ::=
unit_identifier
| '(' unit_identifier ',' keyword_argument ( ',' keyword_argument )* ')'
| '(' keyword_argument ( ',' keyword_argument )* ')'
file_position_statement ::=
[bB][aA][cC][kK][sS][pP][aA][cC][eE] _file_position_spec
| [eE][nN][dD][fF][iI][lL][eE] _file_position_spec
| [rR][eE][wW][iI][nN][dD] _file_position_spec
| [pP][aA][uU][sS][eE] string_literal?
_io_expressions ::=
'*' | string_literal | identifier | derived_type_member_expression | concatenation_expression | math_expression | parenthesized_expression | call_expression
input_item_list ::=
_expression ( ',' _expression )*
output_item_list ::=
_expression ( ',' _expression )*
_expression ::=
number_literal
| complex_literal
| string_literal
| boolean_literal
| array_literal
| null_literal
| identifier
| derived_type_member_expression
| logical_expression
| relational_expression
| concatenation_expression
| math_expression
| unary_expression
| parenthesized_expression
| call_expression
| implied_do_loop_expression
parenthesized_expression ::=
'(' _expression ')'
derived_type_member_expression ::=
_expression '%' identifier
logical_expression ::=
_expression '.'[oO][rR]'.' _expression
| _expression '.'[aA][nN][dD]'.' _expression
| _expression '.'[eE][qQ][vV]'.' _expression
| _expression '.'[nN][eE][qQ][vV]'.' _expression
| '.'[nN][oO][tT]'.' _expression
relational_expression ::=
_expression '<' _expression
| _expression '.'[lL][tT]'.' _expression
| _expression '>' _expression
| _expression '.'[gG][tT]'.' _expression
| _expression '<=' _expression
| _expression '.'[lL][eE]'.' _expression
| _expression '>=' _expression
| _expression '.'[gG][eE]'.' _expression
| _expression '==' _expression
| _expression '.'[eE][qQ]'.' _expression
| _expression '/=' _expression
| _expression '.'[nN][eE]'.' _expression
concatenation_expression ::=
_expression '//' _expression
math_expression ::=
_expression '+' _expression
| _expression '-' _expression
| _expression '*' _expression
| _expression '/' _expression
| _expression '**' _expression
| _expression user_defined_operator _expression
unary_expression ::=
( '-' | '+' | user_defined_operator ) _expression
user_defined_operator ::=
'.' [a-zA-Z]+ '.'
call_expression ::=
_expression argument_list+
implied_do_loop_expression ::=
'(' _expression ( ',' _expression )* ',' loop_control_expression ')'
argument_list ::=
'(' ( ( keyword_argument | extent_specifier | assumed_size | assumed_rank | _expression ) ( ',' ( keyword_argument | extent_specifier | assumed_size | assumed_rank | _expression ) )* )? ')'
keyword_argument ::=
identifier '=' ( _expression | assumed_size | assumed_shape )
extent_specifier ::=
_expression? ':' ( _expression | assumed_size )? ( ':' _expression )?
assumed_size ::=
'*'
assumed_shape ::=
':'
assumed_rank ::=
'..'
block_label_start_expression ::=
identifier ':'
_block_label ::=
identifier
loop_control_expression ::=
identifier '=' _expression ',' _expression ( ',' _expression )?
array_literal ::=
_array_constructor_legacy
| _array_constructor_f2003
_array_constructor_legacy ::=
'(/' _ac_value_list '/)'
_array_constructor_f2003 ::=
'[' _ac_value_list ']'
_type_spec ::=
( _intrinsic_type | derived_type ) '::'
_ac_value_list ::=
_type_spec
| _type_spec? _expression ( ',' _expression )*
complex_literal ::=
'(' ( number_literal | identifier | unary_expression ) ',' ( number_literal | identifier | unary_expression ) ')'
number_literal ::=
_integer_literal
| _float_literal
| _boz_literal
boolean_literal ::=
( ( '.'[tT][rR][uU][eE]'.' | '.'[fF][aA][lL][sS][eE]'.' ) ( '_' [a-zA-Z_]+ )? )
null_literal ::=
[nN][uU][lL][lL] '(' ')'
preproc_file_line ::=
'#' [0-9]+ '"'[^"#x0A]*'"' [0-9]+? _newline
identifier ::=
[a-zA-Z_][a-zA-Z_]*
| [bB][lL][oO][cC][kK]
| [bB][yY][tT][eE]
| [cC][yY][cC][lL][eE]
| [dD][aA][tT][aA]
| [dD][oO][uU][bB][lL][eE]
| [eE][lL][sS][eE][iI][fF]
| [eE][nN][dD]
| [eE][nN][dD][iI][fF]
| [eE][rR][rR][oO][rR]
| [eE][xX][iI][tT]
| [fF][oO][rR][mM][aA][tT]
| [iI][fF]
| [iI][nN][qQ][uU][iI][rR][eE]
| [nN][uU][lL][lL]
| [rR][eE][aA][dD]
| [rR][eE][aA][lL]
| [sS][eE][lL][eE][cC][tT]
| [sS][tT][oO][pP]
| [tT][aA][rR][gG][eE][tT]
| [vV][aA][lL][uU][eE]
| [wW][rR][iI][tT][eE]
comment ::=
( '!' '.'* )
_line_continuation ::=
'&'
_semicolon ::=
';'
_newline ::=
'\n'