-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtree-sitter-ocaml.ebnf
1027 lines (759 loc) · 24 KB
/
tree-sitter-ocaml.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
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// From tree-sitter-ocaml/ocaml/src/grammar.json
//
//
// EBNF to generate railroad diagram at
// (IPV6) https://www.bottlecaps.de/rr/ui
// (IPV4) https://rr.red-dove.com/ui
//
compilation_unit ::=
shebang? _structure?
shebang ::=
'#!.'*
_structure ::=
';;'+
| ';;'* ( _structure_item | toplevel_directive | expression_item ) ( ';;'* ( _structure_item | toplevel_directive ) | ';;'+ expression_item )* ';;'*
expression_item ::=
_sequence_expression item_attribute*
_signature ::=
';;'+
| ( ';;'* _signature_item )+ ';;'*
toplevel_directive ::=
directive ( _constant | value_path | module_path )?
_structure_item ::=
value_definition
| external
| type_definition
| exception_definition
| module_definition
| module_type_definition
| open_module
| include_module
| class_definition
| class_type_definition
| floating_attribute
| _item_extension
value_definition ::=
( 'let' _attribute? 'rec'? | let_operator ) let_binding ( ( 'and' | let_and_operator ) let_binding )*
let_binding ::=
_binding_pattern ( _parameter* _polymorphic_typed? ( ':>' _type )? '=' _sequence_expression )? item_attribute*
_parameter ::=
parameter
| _parenthesized_abstract_type
parameter ::=
_simple_pattern
| ( '~' | '?' ) _simple_value_pattern
| _label ':' _simple_pattern
| ( '~' | '?' ) '(' _simple_value_pattern _typed? ( '=' _sequence_expression )? ')'
| _label ':' '(' _pattern _typed? '=' _sequence_expression ')'
external ::=
'external' _attribute? _value_name _polymorphic_typed '=' string+ item_attribute*
type_definition ::=
'type' _attribute? 'nonrec'? type_binding ( 'and' type_binding )*
type_binding ::=
_type_params? ( _type_constructor _type_equation? ( '=' 'private'? ( variant_declaration | record_declaration | '..' ) )? type_constraint* | type_constructor_path '+=' 'private'? variant_declaration ) item_attribute*
_type_params ::=
_type_param
| '(' _type_param ( ',' _type_param )* ')'
_type_param ::=
( '+' '!'? | '-' '!'? | '!' ( '+' | '-' )? )? ( type_variable | '_' )
_type_equation ::=
( '=' | ':=' ) 'private'? _type
variant_declaration ::=
'|' ( constructor_declaration ( '|' constructor_declaration )* )?
| constructor_declaration ( '|' constructor_declaration )*
constructor_declaration ::=
( _constructor_name | ( '[' ']' | '(' ')' | 'true' | 'false' ) ) ( 'of' _constructor_argument | ':' ( type_variable+ '.' )? ( _constructor_argument '->' )? _simple_type | '=' constructor_path )?
_constructor_argument ::=
_simple_type ( '*' _simple_type )*
| record_declaration
record_declaration ::=
'{' field_declaration ( ';' field_declaration )* ';'? '}'
field_declaration ::=
'mutable'? _field_name _polymorphic_typed
type_constraint ::=
'constraint' _type '=' _type
exception_definition ::=
'exception' _attribute? constructor_declaration item_attribute*
module_definition ::=
'module' _attribute? 'rec'? module_binding ( 'and' module_binding )*
module_binding ::=
( _module_name | '_' ) module_parameter* _module_typed? ( ( '=' | ':=' ) _module_expression )? item_attribute*
module_parameter ::=
'(' ( ( _module_name | '_' ) _module_typed )? ')'
module_type_definition ::=
'module' 'type' _attribute? _module_type_name ( ( '=' | ':=' ) _module_type )? item_attribute*
open_module ::=
'open' '!'? _attribute? _module_expression item_attribute*
include_module ::=
'include' _attribute? _module_expression item_attribute*
class_definition ::=
'class' _attribute? class_binding ( 'and' class_binding )*
class_binding ::=
'virtual'? ( '[' _type_param ( ',' _type_param )* ']' )? _class_name _parameter* _class_typed? ( '=' _class_expression )? item_attribute*
class_type_definition ::=
'class' 'type' _attribute? class_type_binding ( 'and' class_type_binding )*
class_type_binding ::=
'virtual'? ( '[' _type_param ( ',' _type_param )* ']' )? _class_type_name '=' _simple_class_type item_attribute*
_signature_item ::=
value_specification
| external
| type_definition
| exception_definition
| module_definition
| module_type_definition
| open_module
| include_module_type
| class_definition
| class_type_definition
| floating_attribute
| _item_extension
value_specification ::=
'val' _attribute? _value_name _polymorphic_typed item_attribute*
include_module_type ::=
'include' _attribute? _module_type item_attribute*
_module_typed ::=
':' _module_type
_module_type ::=
module_type_path
| signature
| module_type_constraint
| module_type_of
| functor_type
| parenthesized_module_type
| _extension
signature ::=
'sig' _signature? 'end'
module_type_constraint ::=
_module_type 'with' ( constrain_type | constrain_module | constrain_module_type ) ( 'and' ( constrain_type | constrain_module | constrain_module_type ) )*
constrain_type ::=
'type' _type_params? type_constructor_path _type_equation type_constraint*
constrain_module ::=
'module' module_path ( '=' | ':=' ) extended_module_path
constrain_module_type ::=
'module' 'type' module_type_path ( '=' | ':=' ) _module_type
module_type_of ::=
'module' 'type' 'of' _module_expression
functor_type ::=
( 'functor' module_parameter* | _module_type | '(' ')' ) '->' _module_type
parenthesized_module_type ::=
'(' _module_type ')'
_simple_module_expression ::=
typed_module_expression
| parenthesized_module_expression
| packed_module
| _extension
_module_expression ::=
_simple_module_expression
| module_path
| structure
| functor
| module_application
structure ::=
'struct' _structure? 'end'
functor ::=
'functor' module_parameter+ '->' _module_expression
module_application ::=
_module_expression ( _simple_module_expression | '(' ')' )
typed_module_expression ::=
'(' _module_expression _module_typed ')'
packed_module ::=
'(' 'val' _expression _module_typed? ( ':>' _module_type )? ')'
parenthesized_module_expression ::=
'(' _module_expression ')'
_class_typed ::=
':' _class_type
_simple_class_type ::=
class_type_path
| instantiated_class_type
| class_body_type
| let_open_class_type
| _extension
_class_type ::=
_simple_class_type
| class_function_type
instantiated_class_type ::=
'[' _type ( ',' _type )* ']' class_type_path
class_body_type ::=
'object' ( '(' _type ')' )? ( _class_field_specification | floating_attribute )* 'end'
_class_field_specification ::=
inheritance_specification
| instance_variable_specification
| method_specification
| type_parameter_constraint
| _item_extension
inheritance_specification ::=
'inherit' _simple_class_type item_attribute*
instance_variable_specification ::=
'val' ( 'mutable' | 'virtual' )* _instance_variable_name _typed item_attribute*
method_specification ::=
'method' ( 'private' | 'virtual' )* _method_name _polymorphic_typed item_attribute*
type_parameter_constraint ::=
'constraint' _type '=' _type item_attribute*
let_open_class_type ::=
'let' open_module 'in' _simple_class_type
class_function_type ::=
( '?'? _label_name ':' )? _tuple_type '->' _class_type
_simple_class_expression ::=
class_path
| instantiated_class
| object_expression
| typed_class_expression
| parenthesized_class_expression
| _extension
_class_expression ::=
_simple_class_expression
| class_function
| class_application
| let_class_expression
| let_open_class_expression
instantiated_class ::=
'[' _type ( ',' _type )* ']' class_path
typed_class_expression ::=
'(' _class_expression _class_typed ')'
class_function ::=
'fun' _parameter+ '->' _class_expression
class_application ::=
_simple_class_expression _argument+
let_class_expression ::=
value_definition 'in' _class_expression
_class_field ::=
inheritance_definition
| instance_variable_definition
| method_definition
| type_parameter_constraint
| class_initializer
| _item_extension
inheritance_definition ::=
'inherit' '!'? _class_expression ( 'as' _value_pattern )? item_attribute*
instance_variable_definition ::=
'val' '!'? ( 'mutable' | 'virtual' )* _instance_variable_name _typed? ( ':>' _type )? ( '=' _sequence_expression )? item_attribute*
method_definition ::=
'method' '!'? ( 'private' | 'virtual' )* _method_name _parameter* _polymorphic_typed? ( '=' _sequence_expression )? item_attribute*
class_initializer ::=
'initializer' _sequence_expression item_attribute*
let_open_class_expression ::=
'let' open_module 'in' _class_expression
parenthesized_class_expression ::=
'(' _class_expression ')'
_typed ::=
':' _type
_simple_typed ::=
':' _simple_type
_polymorphic_typed ::=
':' _polymorphic_type
_polymorphic_type ::=
polymorphic_type
| _type
polymorphic_type ::=
( type_variable+ | _abstract_type ) '.' _type
_abstract_type ::=
'type' _type_constructor+
_parenthesized_abstract_type ::=
'(' _abstract_type ')'
_simple_type ::=
type_variable
| type_constructor_path
| constructed_type
| local_open_type
| polymorphic_variant_type
| package_type
| hash_type
| object_type
| parenthesized_type
| _extension
_tuple_type ::=
_simple_type
| tuple_type
_type ::=
_tuple_type
| function_type
| aliased_type
function_type ::=
( typed_label | _type ) '->' _type
typed_label ::=
'?'? _label_name ':' _type
tuple_type ::=
_tuple_type '*' _simple_type
constructed_type ::=
( _simple_type | '(' _type ( ',' _type )* ')' ) type_constructor_path
aliased_type ::=
_type 'as' type_variable
local_open_type ::=
extended_module_path '.' ( '(' _type ')' | package_type | polymorphic_variant_type )
polymorphic_variant_type ::=
( '[' tag_specification ']' | '[' _tag_spec? '|' _tag_spec ( '|' _tag_spec )* ']' | '[>' '|'? ( _tag_spec ( '|' _tag_spec )* )? ']' | '[<' '|'? _tag_spec ( '|' _tag_spec )* ( '>' tag+ )? ']' )
_tag_spec ::=
_type
| tag_specification
tag_specification ::=
tag ( 'of' '&'? _type ( '&' _type )* )?
package_type ::=
'(' 'module' _attribute? _module_type ')'
object_type ::=
'<' ( ( method_type | _simple_type ) ( ';' ( method_type | _simple_type ) )* ( ';' '..'? )? | '..' )? '>'
method_type ::=
_method_name _polymorphic_typed
hash_type ::=
( _simple_type | '(' _type ( ',' _type )* ')' )? '#' class_type_path
parenthesized_type ::=
'(' _type ')'
_simple_expression ::=
value_path
| _constant
| typed_expression
| constructor_path
| tag
| list_expression
| array_expression
| record_expression
| prefix_expression
| hash_expression
| field_get_expression
| array_get_expression
| string_get_expression
| bigarray_get_expression
| coercion_expression
| local_open_expression
| package_expression
| new_expression
| object_copy_expression
| method_invocation
| object_expression
| parenthesized_expression
| ocamlyacc_value
| _extension
_expression ::=
_simple_expression
| product_expression
| cons_expression
| application_expression
| infix_expression
| sign_expression
| set_expression
| if_expression
| while_expression
| for_expression
| match_expression
| function_expression
| fun_expression
| try_expression
| let_expression
| assert_expression
| lazy_expression
| let_module_expression
| let_open_expression
| let_exception_expression
_sequence_expression ::=
_expression
| sequence_expression
typed_expression ::=
'(' _sequence_expression _typed ')'
product_expression ::=
_expression ',' _expression
cons_expression ::=
_expression '::' _expression
list_expression ::=
'[' ( _expression ( ';' _expression )* ';'? )? ']'
array_expression ::=
'[|' ( _expression ( ';' _expression )* ';'? )? '|]'
record_expression ::=
'{' ( _simple_expression 'with' )? field_expression ( ';' field_expression )* ';'? '}'
field_expression ::=
field_path _typed? ( '=' _expression )?
application_expression ::=
_simple_expression _argument+
_argument ::=
_simple_expression
| labeled_argument
labeled_argument ::=
_label
| _label ':' _simple_expression
| ( '~' | '?' ) '(' _label_name _typed ')'
prefix_expression ::=
prefix_operator _simple_expression
sign_expression ::=
sign_operator _expression
hash_expression ::=
_simple_expression hash_operator _simple_expression
infix_expression ::=
_expression pow_operator _expression
| _expression mult_operator _expression
| _expression add_operator _expression
| _expression concat_operator _expression
| _expression rel_operator _expression
| _expression and_operator _expression
| _expression or_operator _expression
| _expression assign_operator _expression
field_get_expression ::=
_simple_expression '.' field_path
array_get_expression ::=
_simple_expression '.' indexing_operator_path? '(' _sequence_expression ')'
string_get_expression ::=
_simple_expression '.' indexing_operator_path? '[' _sequence_expression ']'
bigarray_get_expression ::=
_simple_expression '.' indexing_operator_path? '{' _sequence_expression '}'
set_expression ::=
( field_get_expression | array_get_expression | string_get_expression | bigarray_get_expression | _instance_variable_name ) '<-' _expression
if_expression ::=
'if' _attribute? _sequence_expression then_clause else_clause?
then_clause ::=
'then' _expression
else_clause ::=
'else' _expression
while_expression ::=
'while' _attribute? _sequence_expression do_clause
do_clause ::=
'do' _sequence_expression? 'done'
for_expression ::=
'for' _attribute? _value_pattern '=' _sequence_expression ( 'to' | 'downto' ) _sequence_expression do_clause
sequence_expression ::=
_expression ';' ( _attribute? _sequence_expression )?
match_expression ::=
( 'match' _attribute? | match_operator ) _sequence_expression 'with' _match_cases
_match_cases ::=
'|'? match_case ( '|' match_case )*
match_case ::=
_pattern guard? '->' ( _sequence_expression | refutation_case )
guard ::=
'when' _sequence_expression
refutation_case ::=
'.'
function_expression ::=
'function' _attribute? _match_cases
fun_expression ::=
'fun' _attribute? _parameter+ _simple_typed? '->' _sequence_expression
try_expression ::=
'try' _attribute? _sequence_expression 'with' _match_cases
let_expression ::=
value_definition 'in' _sequence_expression
coercion_expression ::=
'(' _sequence_expression _typed? ':>' _type ')'
assert_expression ::=
'assert' _attribute? _simple_expression
lazy_expression ::=
'lazy' _attribute? _simple_expression
let_module_expression ::=
'let' module_definition 'in' _sequence_expression
let_open_expression ::=
'let' open_module 'in' _sequence_expression
local_open_expression ::=
module_path '.' ( '(' _sequence_expression? ')' | list_expression | array_expression | record_expression | object_copy_expression | package_expression )
package_expression ::=
'(' 'module' _attribute? _module_expression _module_typed? ')'
let_exception_expression ::=
'let' exception_definition 'in' _sequence_expression
new_expression ::=
'new' _attribute? class_path
object_copy_expression ::=
'{<' ( instance_variable_expression ( ';' instance_variable_expression )* )? ';'? '>}'
instance_variable_expression ::=
_instance_variable_name ( '=' _expression )?
method_invocation ::=
_simple_expression '#' _method_name
object_expression ::=
'object' _attribute? ( '(' _pattern _typed? ')' )? ( _class_field | floating_attribute )* 'end'
parenthesized_expression ::=
'begin' _attribute? _sequence_expression 'end'
| '(' _sequence_expression ')'
ocamlyacc_value ::=
'\$'[0-9]+
_simple_pattern ::=
_value_pattern
| _signed_constant
| typed_pattern
| constructor_path
| tag
| polymorphic_variant_pattern
| record_pattern
| list_pattern
| array_pattern
| local_open_pattern
| package_pattern
| parenthesized_pattern
| _extension
_pattern ::=
_simple_pattern
| alias_pattern
| or_pattern
| constructor_pattern
| tag_pattern
| tuple_pattern
| cons_pattern
| range_pattern
| lazy_pattern
| exception_pattern
_binding_pattern ::=
_value_name
| _signed_constant
| typed_binding_pattern
| constructor_path
| tag
| polymorphic_variant_pattern
| record_binding_pattern
| list_binding_pattern
| array_binding_pattern
| local_open_binding_pattern
| package_pattern
| parenthesized_binding_pattern
| alias_binding_pattern
| or_binding_pattern
| constructor_binding_pattern
| tag_binding_pattern
| tuple_binding_pattern
| cons_binding_pattern
| range_pattern
| lazy_binding_pattern
| _extension
alias_pattern ::=
_pattern 'as' _value_pattern
alias_binding_pattern ::=
_binding_pattern 'as' _value_name
typed_pattern ::=
'(' _pattern _typed ')'
typed_binding_pattern ::=
'(' _binding_pattern _typed ')'
or_pattern ::=
_pattern '|' _pattern
or_binding_pattern ::=
_binding_pattern '|' _binding_pattern
constructor_pattern ::=
constructor_path _parenthesized_abstract_type? _pattern
constructor_binding_pattern ::=
constructor_path _binding_pattern
tag_pattern ::=
tag _pattern
tag_binding_pattern ::=
tag _binding_pattern
polymorphic_variant_pattern ::=
'#' type_constructor_path
tuple_pattern ::=
_pattern ',' _pattern
tuple_binding_pattern ::=
_binding_pattern ',' _binding_pattern
record_pattern ::=
'{' field_pattern ( ';' field_pattern )* ( ';' '_' )? ';'? '}'
field_pattern ::=
field_path _typed? ( '=' _pattern )?
record_binding_pattern ::=
'{' field_binding_pattern ( ';' field_binding_pattern )* ( ';' '_' )? ';'? '}'
field_binding_pattern ::=
field_path _typed? ( '=' _binding_pattern )?
list_pattern ::=
'[' ( _pattern ( ';' _pattern )* ';'? )? ']'
list_binding_pattern ::=
'[' ( _binding_pattern ( ';' _binding_pattern )* ';'? )? ']'
cons_pattern ::=
_pattern '::' _pattern
cons_binding_pattern ::=
_binding_pattern '::' _binding_pattern
array_pattern ::=
'[|' ( _pattern ( ';' _pattern )* ';'? )? '|]'
array_binding_pattern ::=
'[|' ( _binding_pattern ( ';' _binding_pattern )* ';'? )? '|]'
range_pattern ::=
_signed_constant '..' _signed_constant
lazy_pattern ::=
'lazy' _attribute? _pattern
lazy_binding_pattern ::=
'lazy' _attribute? _binding_pattern
local_open_pattern ::=
module_path '.' ( '(' _pattern? ')' | list_pattern | array_pattern | record_pattern )
local_open_binding_pattern ::=
module_path '.' ( '(' _binding_pattern? ')' | list_binding_pattern | array_binding_pattern | record_binding_pattern )
package_pattern ::=
'(' 'module' _attribute? ( _module_name | '_' ) _module_typed? ')'
parenthesized_pattern ::=
'(' _pattern ')'
parenthesized_binding_pattern ::=
'(' _binding_pattern ')'
exception_pattern ::=
'exception' _attribute? _pattern
attribute ::=
'#x5B@' attribute_id attribute_payload? ']'
item_attribute ::=
'[@@' attribute_id attribute_payload? ']'
floating_attribute ::=
'[@@@' attribute_id attribute_payload? ']'
attribute_payload ::=
_structure
| ':' ( _type | _signature )?
| '?' _pattern guard?
_extension ::=
extension
| quoted_extension
extension ::=
'[%' attribute_id attribute_payload? ']'
quoted_extension ::=
'{%' attribute_id [ #x09#x0A#x0B#x0C#x0D]+? _quoted_string '}'
_item_extension ::=
item_extension
| quoted_item_extension
item_extension ::=
'[%%' attribute_id attribute_payload? ']' item_attribute*
quoted_item_extension ::=
'{%%' attribute_id [ #x09#x0A#x0B#x0C#x0D]+? _quoted_string '}' item_attribute*
_attribute ::=
'%' attribute_id
_constant ::=
number
| character
| string
| quoted_string
| boolean
| unit
_signed_constant ::=
_constant
| signed_number
number ::=
( [0-9][0-9_]*('.'[0-9_]*)?([eE][+#x2D-]?[0-9][0-9_]*)?[g-zG-Z]? | '0'[xX][0-9A-Fa-f][0-9A-Fa-f_]*('.'[0-9A-Fa-f_]*)?([pP][+#x2D-]?[0-9][0-9_]*)?[g-zG-Z]? | '0'[oO][0-7][0-7_]*[g-zG-Z]? | '0'[bB][01][01_]*[g-zG-Z]? )
signed_number ::=
[+-] ( [0-9][0-9_]*('.'[0-9_]*)?([eE][+#x2D-]?[0-9][0-9_]*)?[g-zG-Z]? | '0'[xX][0-9A-Fa-f][0-9A-Fa-f_]*('.'[0-9A-Fa-f_]*)?([pP][+#x2D-]?[0-9][0-9_]*)?[g-zG-Z]? | '0'[oO][0-7][0-7_]*[g-zG-Z]? | '0'[bB][01][01_]*[g-zG-Z]? )
character ::=
"'" character_content "'"
character_content ::=
[^\']
| _null
| escape_sequence
string ::=
'"' string_content? '"'
string_content ::=
( [ #x09#x0A#x0B#x0C#x0D] | '#x5B@' | [^\"%@]+|'%'|'@' | _null | escape_sequence | '\u\{'[0-9A-Fa-f]+'\}' | '\#x0A'[#x09 ]* | conversion_specification | pretty_printing_indication )+
quoted_string ::=
'{' _quoted_string '}'
_quoted_string ::=
_left_quoted_string_delimiter quoted_string_content? _right_quoted_string_delimiter
quoted_string_content ::=
( [ #x09#x0A#x0B#x0C#x0D] | '#x5B@' | [^%@|]+|'%'|'@'|'\'| | _null | conversion_specification | pretty_printing_indication )+
escape_sequence ::=
'\'[\"'ntbr ]
| '\'[0-9][0-9][0-9]
| '\x'[0-9A-Fa-f][0-9A-Fa-f]
| '\o'[0-3][0-7][0-7]
conversion_specification ::=
( '%' [#x2D-0+ #x23]? [1-9][0-9]*|'\'*? '.'([0-9]*|'\'*)? ( [diunlLNxXosScCfFeEgGhHbBat!%@,] | [lnL][diuxXo] ) )
pretty_printing_indication ::=
'@'([#x5B#x5D, ;.{}?]|'\n'|'<'[0-9]+'>')
boolean ::=
'true'
| 'false'
unit ::=
'(' ')'
| 'begin' 'end'
prefix_operator ::=
( '!' ( [#x23!$%&*+#x2D-./:<>?@^|~] | [#x23!$%&*+#x2D-./:<=>?@^|~] [#x23!$%&*+#x2D-./:<=>?@^|~]+ ) | [~?] [#x23!$%&*+#x2D-./:<=>?@^|~]+ )
sign_operator ::=
[+-]
| [+-]'.'
_infix_operator ::=
pow_operator
| mult_operator
| add_operator
| concat_operator
| rel_operator
| and_operator
| or_operator
| assign_operator
hash_operator ::=
( '#' [#x23!$%&*+#x2D-./:<=>?@^|~]+ )
pow_operator ::=
( 'lsl' | 'lsr' | 'asr' | '**' [!$%&*+#x2D-./:<=>?@^|~]* )
mult_operator ::=
( 'mod' | 'land' | 'lor' | 'lxor' | [*/%] [!$%&*+#x2D-./:<=>?@^|~]* )
add_operator ::=
[+-]
| [+-]'.'
| ( '+' [!$%&*+#x2D-./:<=>?@^|~]+ | '-' ( [!$%&*+#x2D-./:<=?@^|~]+ | [!$%&*+#x2D-./:<=>?@^|~] [!$%&*+#x2D-./:<=>?@^|~]+ ) )
concat_operator ::=
( [@^] [!$%&*+#x2D-./:<=>?@^|~]* )
rel_operator ::=
( [=>$] [!$%&*+#x2D-./:<=>?@^|~]* | '<' ( [!$%&*+./:<=>?@^|~] | [!$%&*+#x2D-./:<=>?@^|~] [!$%&*+#x2D-./:<=>?@^|~]+ ) | '&' ( [!$%*+#x2D-./:<=>?@^|~] | [!$%&*+#x2D-./:<=>?@^|~] [!$%&*+#x2D-./:<=>?@^|~]+ ) | '|' ( [!$%&*+#x2D-./:<=>?@^~] | [!$%&*+#x2D-./:<=>?@^|~] [!$%&*+#x2D-./:<=>?@^|~]+ ) | '!=' )
and_operator ::=
( '&' | '&&' )
or_operator ::=
( 'or' | '||' )
assign_operator ::=
':='
indexing_operator ::=
( [!$%&*+#x2D-/:=>?@^|] [!$%&*+#x2D-./:<=>?@^|~]* )
indexing_operator_path ::=
indexing_operator
| module_path '.' indexing_operator
let_operator ::=
( 'let' [$&*+#x2D-/<=>@^|] [!$%&*+#x2D-./:<=>?@^|~]* )
let_and_operator ::=
( 'and' [$&*+#x2D-/<=>@^|] [!$%&*+#x2D-./:<=>?@^|~]* )
match_operator ::=
( 'match' [$&*+#x2D-/<=>@^|] [!$%&*+#x2D-./:<=>?@^|~]* )
_value_name ::=
_identifier
| parenthesized_operator
_simple_value_pattern ::=
_identifier
_value_pattern ::=
_simple_value_pattern
| parenthesized_operator
parenthesized_operator ::=
'(' ( prefix_operator | _infix_operator | hash_operator | '.' indexing_operator ( '(' ( ';' '..' )? ')' | '[' ( ';' '..' )? ']' | '{' ( ';' '..' )? '}' ) '<-'? | let_operator | let_and_operator | match_operator ) ')'
value_path ::=
_value_name
| module_path '.' _value_name
module_path ::=
_module_name | module_path '.' _module_name
extended_module_path ::=
_module_name
| extended_module_path '.' _module_name
| extended_module_path '(' extended_module_path ')'
module_type_path ::=
_module_type_name
| extended_module_path '.' _module_type_name
field_path ::=
_field_name
| module_path '.' _field_name
constructor_path ::=
_constructor_name
| module_path '.' _constructor_name
type_constructor_path ::=
_type_constructor
| extended_module_path '.' _type_constructor
class_path ::=
_class_name
| module_path '.' _class_name
class_type_path ::=
_class_type_name
| extended_module_path '.' _class_type_name
_label_name ::=
_identifier
_field_name ::=
_identifier
_class_name ::=
_identifier
_class_type_name ::=
_identifier
_method_name ::=
_identifier
_type_constructor ::=
_identifier
_instance_variable_name ::=
_identifier
_module_name ::=
_capitalized_identifier
_module_type_name ::=