cgrammar 0.9.1

A comprehensive C language grammar parser library written in Rust, implementing the C23 standard (ISO/IEC 9899:2023).
Documentation
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

/*n3096*/
(6.4) token:
  keyword
  identifier
  constant
  string-literal
  punctuator

(6.4) preprocessing-token:
  header-name
  identifier
  pp-number
  character-constant
  string-literal
  punctuator
  /*each universal-character-name that cannot be one of the above
    each non-white-space character that cannot be one of the above*/

(6.4.1) keyword: one of

"alignas" "alignof" "auto" "bool"
"break" "case" "char"
"const" "constexpr" "continue"
"default" "do" "double" "else"
 "enum" "extern" "false" "float" "for"
"goto" "if"
 "inline" "int" "long" "nullptr" "register" "restrict" "return"
 "short" "signed" "sizeof" "static"
"static_assert" "struct" "switch"
"thread_local" "true"
"typedef"
"typeof"
"typeof_unqual" "union" "unsigned"
"void"
"volatile" "while"
"_Atomic"
"_BitInt"
"_Complex"
"_Decimal128"
"_Decimal32"
"_Decimal64" "
"_Generic"
"_Imaginary"
"_Noreturn"


(6.4.2.1) identifier:
  identifier-start
  identifier identifier-continue

(6.4.2.1) identifier-start:
  nondigit
  XID_Start character
  universal-character-name of class XID_Start

(6.4.2.1) identifier-continue:
 digit
 nondigit
 XID_Continue character
 universal-character-name of class XID_Continue

(6.4.2.1) nondigit: one of
_ a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z

(6.4.2.1) digit: one of
  0 1 2 3 4 5 6 7 8 9

(6.4.3) universal-character-name:
  \u hex-quad
  \U hex-quad hex-quad

(6.4.3) hex-quad:
  hexadecimal-digit hexadecimal-digit hexadecimal-digit hexadecimal-digit


(6.4.4) constant:
  integer-constant
  floating-constant
  enumeration-constant
  character-constant
  predefined-constant

(6.4.4.1) integer-constant:
  decimal-constant
  integer-suffix opt
  octal-constant
  integer-suffix opt
  hexadecimal-constant
  integer-suffix opt
  binary-constant
  integer-suffix opt

(6.4.4.1) decimal-constant:
   nonzero-digit
  decimal-constant ' opt  digit

(6.4.4.1) octal-constant:
   0
   octal-constant ' opt  octal-digit

(6.4.4.1) hexadecimal-constant:
   hexadecimal-prefix hexadecimal-digit-sequence

(6.4.4.1) binary-constant:
  binary-prefix binary-digit
  binary-constant ' opt  binary-digit

(6.4.4.1) hexadecimal-prefix: one of
  0x 0X

(6.4.4.1) binary-prefix: one of
  0b 0B

(6.4.4.1) nonzero-digit: one of
  1 2 3 4 5 6 7 8 9

(6.4.4.1) octal-digit: one of
   0 1 2 3 4 5 6 7

hexadecimal-digit-sequence:
  hexadecimal-digit
  hexadecimal-digit-sequence ' opt  hexadecimal-digit


(6.4.4.1) hexadecimal-digit: one of
  0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F

(6.4.4.1) binary-digit: one of
   0 1

(6.4.4.1) integer-suffix:
   unsigned-suffix long-suffix opt
   unsigned-suffix long-long-suffix
   unsigned-suffix bit-precise-int-suffix
   long-suffix unsigned-suffix opt
   long-long-suffix unsigned-suffix opt
   bit-precise-int-suffix unsigned-suffix opt

(6.4.4.1) bit-precise-int-suffix: one of
   wb WB

(6.4.4.1) unsigned-suffix: one of
  u U

(6.4.4.1) long-suffix: one of
  l L

(6.4.4.1) long-long-suffix: one of
  ll LL

(6.4.4.2) floating-constant:
  decimal-floating-constant
  hexadecimal-floating-constant

(6.4.4.2) decimal-floating-constant:
   fractional-constant exponent-part opt  floating-suffix opt
   digit-sequence exponent-part floating-suffix opt

(6.4.4.2) hexadecimal-floating-constant:
  hexadecimal-prefix hexadecimal-fractional-constant
                     binary-exponent-part floating-suffix opt
  hexadecimal-prefix hexadecimal-digit-sequence
                     binary-exponent-part floating-suffix opt

(6.4.4.2) fractional-constant:
   digit-sequence opt  . digit-sequence
   digit-sequence .

(6.4.4.2) exponent-part:
    e sign opt  digit-sequence
    E sign opt  digit-sequence

(6.4.4.2) sign: one of
   + -

(6.4.4.2) digit-sequence:
  digit
  digit-sequence ' opt  digit

(6.4.4.2) hexadecimal-fractional-constant:
     hexadecimal-digit-sequence opt  . hexadecimal-digit-sequence
     hexadecimal-digit-sequence .

(6.4.4.2) binary-exponent-part:
      p sign opt  digit-sequence
      P sign opt  digit-sequence

(6.4.4.2) floating-suffix: one of
   f l F L df dd dl DF DD DL

(6.4.4.3) enumeration-constant:
  identifier

(6.4.4.4) character-constant:
  encoding-prefix opt  ' c-char-sequence '

(6.4.4.4) encoding-prefix: one of
	u8	u	U	L

(6.4.4.4) c-char-sequence:
   c-char
   c-char-sequence c-char

(6.4.4.4) c-char:
  /*any member of the source character set except the single-quote ', backslash \, or new-line character*/
    escape-sequence

(6.4.4.4) escape-sequence:
   simple-escape-sequence
   octal-escape-sequence
   hexadecimal-escape-sequence
   universal-character-name

(6.4.4.4) simple-escape-sequence: one of
   \' \" \? \\ \a \b \f \n \r \t \v

(6.4.4.4) octal-escape-sequence:
  \ octal-digit
  \ octal-digit octal-digit \ octal-digit octal-digit octal-digit

(6.4.4.4) hexadecimal-escape-sequence:
  \x hexadecimal-digit
  hexadecimal-escape-sequence hexadecimal-digit

(6.4.4.5) predefined-constant:
  "false"
  "true"
  "nullptr"

(6.4.5) string-literal:
   encoding-prefix opt  " s-char-sequence opt  "

(6.4.5) s-char-sequence:
  s-char
  s-char-sequence s-char

(6.4.5) s-char:
  /*any member of the source character set except the double-quote ", backslash \, or new-line character*/
  escape-sequence


(6.4.6) punctuator: one of
  [ ] ( ) { } .	->
  ++ -- & * + - ~ !
  / % << >> < > <= >= == != ^ | && || ? : :: ; ...
  = *= /= %= += -= <<= >>= &= ^= |=
  , # ##
  <:	:> <% %> %:	%:%:

(6.4.7) header-name:
  < h-char-sequence >
  " q-char-sequence "

(6.4.7) h-char-sequence:
   h-char
   h-char-sequence h-char

(6.4.7) h-char:
  /*any member of the source character set except
    the new-line character and >*/

(6.4.7) q-char-sequence:
  q-char
  q-char-sequence q-char

(6.4.7) q-char:
  /*any member of the source character set except
    the new-line character and "*/

(6.4.8) pp-number:
  digit
  . digit
  pp-number identifier-continue
  pp-number ' digit
  pp-number ' nondigit
  pp-number e sign
  pp-number E sign
  pp-number p sign
  pp-number P sign
  pp-number .


(6.5.1) primary-expression:
  identifier
  constant
  string-literal
 ( expression )
  generic-selection

(6.5.1.1) generic-selection:
  "_Generic" ( assignment-expression , generic-assoc-list )

(6.5.1.1) generic-assoc-list:
  generic-association
  generic-assoc-list , generic-association


(6.5.1.1) generic-association:
  type-name : assignment-expression
  "default" : assignment-expression

(6.5.2) postfix-expression:
  primary-expression
  postfix-expression [ expression ]
  postfix-expression ( argument-expression-list opt  )
  postfix-expression . identifier
  postfix-expression -> identifier
  postfix-expression ++
  postfix-expression --
  compound-literal

(6.5.2) argument-expression-list:
  assignment-expression
  argument-expression-list , assignment-expression

(6.5.2.5) compound-literal:
          ( storage-class-specifiers opt  type-name ) braced-initializer

(6.5.2.5) storage-class-specifiers:
  storage-class-specifier
  storage-class-specifiers storage-class-specifier

(6.5.3) unary-expression:
  postfix-expression
  ++ unary-expression
  -- unary-expression
  unary-operator cast-expression
  sizeof unary-expression
  sizeof ( type-name )
  alignof ( type-name )

(6.5.3) unary-operator: one of
   & * + - ~ !

(6.5.4) cast-expression:
   unary-expression
   ( type-name ) cast-expression

(6.5.5) multiplicative-expression:
  cast-expression
  multiplicative-expression * cast-expression
  multiplicative-expression / cast-expression
  multiplicative-expression % cast-expression

(6.5.6) additive-expression:
  multiplicative-expression
  additive-expression + multiplicative-expression
  additive-expression - multiplicative-expression

(6.5.7) shift-expression:
  additive-expression
  shift-expression << additive-expression
  shift-expression >> additive-expression

(6.5.8) relational-expression:
  shift-expression
  relational-expression < shift-expression
  relational-expression > shift-expression
  relational-expression <= shift-expression
  relational-expression >= shift-expression

(6.5.9) equality-expression:
  relational-expression
  equality-expression == relational-expression
  equality-expression != relational-expression

(6.5.10) AND-expression:
   equality-expression
   AND-expression & equality-expression

(6.5.11) exclusive-OR-expression:
   AND-expression
   exclusive-OR-expression ^ AND-expression

(6.5.12) inclusive-OR-expression:
  exclusive-OR-expression
  inclusive-OR-expression | exclusive-OR-expression

(6.5.13) logical-AND-expression:
  inclusive-OR-expression
  logical-AND-expression && inclusive-OR-expression

(6.5.14) logical-OR-expression:
  logical-AND-expression
  logical-OR-expression || logical-AND-expression

(6.5.15) conditional-expression:
  logical-OR-expression
  logical-OR-expression ? expression : conditional-expression

(6.5.16) assignment-expression:
  conditional-expression
  unary-expression assignment-operator assignment-expression

(6.5.16) assignment-operator: one of
   = *= /= %= += -= <<= >>= &= ^= |=

(6.5.17) expression:
   assignment-expression
   expression , assignment-expression

(6.6) constant-expression:
   conditional-expression


(6.7) declaration:
   declaration-specifiers init-declarator-list opt  ;
   attribute-specifier-sequence declaration-specifiers init-declarator-list ;
   static_assert-declaration
   attribute-declaration

(6.7) declaration-specifiers:
    declaration-specifier attribute-specifier-sequence opt
    declaration-specifier declaration-specifiers

(6.7) declaration-specifier:
  storage-class-specifier
  type-specifier-qualifier
  function-specifier

(6.7) init-declarator-list:
  init-declarator
  init-declarator-list , init-declarator

(6.7) init-declarator:
  declarator declarator = initializer

(6.7) attribute-declaration:
  attribute-specifier-sequence ;

(6.7.1) storage-class-specifier:
  "auto"
  "constexpr"
  "extern"
  "register"
  "static"
  "thread_local"
  "typedef"

(6.7.2) type-specifier:
  "void"
 "char"
 "short"
 "int"
 "long"
 "float"
 "double"
 "signed"
 "unsigned"
 "_BitInt" ( constant-expression )
 "bool"
 "_Complex"
 "_Decimal32"
 "_Decimal64"
 "_Decimal128"
 atomic-type-specifier
 struct-or-union-specifier
 enum-specifier
 typedef-name
 typeof-specifier

(6.7.2.1) struct-or-union-specifier:
   struct-or-union attribute-specifier-sequence opt  identifier opt  { member-declaration-list }
   struct-or-union attribute-specifier-sequence opt  identifier

(6.7.2.1) struct-or-union:
  "struct"
  "union"

(6.7.2.1) member-declaration-list:
   member-declaration
   member-declaration-list member-declaration

(6.7.2.1) member-declaration:
  attribute-specifier-sequence opt  specifier-qualifier-list member-declarator-list opt  ;
  static_assert-declaration

(6.7.2.1) specifier-qualifier-list:
   type-specifier-qualifier attribute-specifier-sequence opt
   type-specifier-qualifier specifier-qualifier-list

(6.7.2.1) type-specifier-qualifier:
  type-specifier
  type-qualifier
  alignment-specifier

(6.7.2.1) member-declarator-list:
  member-declarator
  member-declarator-list , member-declarator

(6.7.2.1) member-declarator:
  declarator
  declarator opt  : constant-expression

(6.7.2.2) enum-specifier:
   enum attribute-specifier-sequence opt  identifier opt  enum-type-specifier opt  { enumerator-list }
   enum attribute-specifier-sequence opt  identifier opt  enum-type-specifier opt  { enumerator-list , }
  enum identifier enum-type-specifier opt

(6.7.2.2) enumerator-list:
  enumerator
  enumerator-list , enumerator

(6.7.2.2) enumerator:
  enumeration-constant attribute-specifier-sequence opt
  enumeration-constant attribute-specifier-sequence opt  = constant-expression

(6.7.2.2) enum-type-specifier:
   : specifier-qualifier-list

(6.7.2.4) atomic-type-specifier:
  "_Atomic" ( type-name )

(6.7.2.5) typeof-specifier:
  "typeof" ( typeof-specifier-argument )
  "typeof_unqual" ( typeof-specifier-argument )

(6.7.2.5) typeof-specifier-argument:
  expression
  type-name

(6.7.3) type-qualifier:
  "const"
 "restrict"
 "volatile"
 "_Atomic"

(6.7.4) function-specifier:
 "inline"
 "_Noreturn"

(6.7.5) alignment-specifier:
  "alignas" ( type-name )
  "alignas" ( constant-expression )

(6.7.6) declarator:
  pointer opt  direct-declarator

(6.7.6) direct-declarator:
   identifier attribute-specifier-sequence opt
   ( declarator )
   array-declarator attribute-specifier-sequence opt
   function-declarator attribute-specifier-sequence opt

(6.7.6) array-declarator:
   direct-declarator [ type-qualifier-list opt  assignment-expression opt  ]
   direct-declarator [ static type-qualifier-list opt  assignment-expression ]
   direct-declarator [ type-qualifier-list static assignment-expression ]
   direct-declarator [ type-qualifier-list opt  * ]

(6.7.6) function-declarator:
  direct-declarator ( parameter-type-list opt  )

(6.7.6) pointer:
   * attribute-specifier-sequence opt  type-qualifier-list opt
   * attribute-specifier-sequence opt  type-qualifier-list opt  pointer

(6.7.6) type-qualifier-list:
  type-qualifier
  type-qualifier-list type-qualifier

(6.7.6) parameter-type-list:
   parameter-list
   parameter-list , ...
   ...

(6.7.6) parameter-list:
  parameter-declaration
  parameter-list , parameter-declaration

(6.7.6) parameter-declaration:
  attribute-specifier-sequence opt  declaration-specifiers declarator
  attribute-specifier-sequence opt  declaration-specifiers abstract-declarator opt

(6.7.7) type-name:
  specifier-qualifier-list abstract-declarator opt

(6.7.7) abstract-declarator:
  pointer
  pointer opt  direct-abstract-declarator

(6.7.7) direct-abstract-declarator:
  ( abstract-declarator )
  array-abstract-declarator attribute-specifier-sequence opt
  function-abstract-declarator attribute-specifier-sequence opt

(6.7.7) array-abstract-declarator:
   direct-abstract-declarator opt  [ type-qualifier-list opt  assignment-expression opt  ]
   direct-abstract-declarator opt  [ static type-qualifier-list opt  assignment-expression ]
   direct-abstract-declarator opt  [ type-qualifier-list static assignment-expression ]
   direct-abstract-declarator opt  [ * ]

(6.7.7) function-abstract-declarator:
   direct-abstract-declarator opt  ( parameter-type-list opt  )

(6.7.8) typedef-name:
  identifier

(6.7.10) braced-initializer:
    { }
    { initializer-list }
    { initializer-list , }

(6.7.10) initializer:
   assignment-expression
   braced-initializer

(6.7.10) initializer-list:
   designation opt  initializer
   initializer-list , designation opt  initializer

(6.7.10) designation:
  designator-list =

(6.7.10) designator-list:
  designator
  designator-list designator

(6.7.10) designator:
   [ constant-expression ]
   . identifier

(6.7.11) static_assert-declaration:
  "static_assert" ( constant-expression , string-literal ) ;
  "static_assert" ( constant-expression ) ;

(6.7.12.1) attribute-specifier-sequence:
  attribute-specifier-sequence opt  attribute-specifier

(6.7.12.1) attribute-specifier:
   [ [ attribute-list ] ]

(6.7.12.1) attribute-list:
  attribute opt
  attribute-list , attribute opt

(6.7.12.1) attribute:
  attribute-token attribute-argument-clause opt

(6.7.12.1) attribute-token:
  standard-attribute
  attribute-prefixed-token

(6.7.12.1) standard-attribute:
  identifier

(6.7.12.1) attribute-prefixed-token:
   attribute-prefix :: identifier

(6.7.12.1) attribute-prefix:
  identifier

(6.7.12.1) attribute-argument-clause:
  ( balanced-token-sequence opt  )

(6.7.12.1) balanced-token-sequence:
  balanced-token
  balanced-token-sequence balanced-token

(6.7.12.1) balanced-token:
  ( balanced-token-sequence opt  )
  [ balanced-token-sequence opt  ]
  { balanced-token-sequence opt  }
  /*any token other than a parenthesis, a bracket, or a brace*/

(6.8) statement:
  labeled-statement
  unlabeled-statement

(6.8) unlabeled-statement:
   expression-statement
   attribute-specifier-sequence opt  primary-block
   attribute-specifier-sequence opt  jump-statement

(6.8) primary-block:
   compound-statement
   selection-statement
   iteration-statement

(6.8) secondary-block:
   statement

(6.8.1) label:
  attribute-specifier-sequence opt  identifier :
  attribute-specifier-sequence opt  "case" constant-expression :
  attribute-specifier-sequence opt  "default" :

(6.8.1) labeled-statement:
  label statement

(6.8.2) compound-statement:
  { block-item-list opt  }

(6.8.2) block-item-list:
   block-item
   block-item-list block-item

(6.8.2) block-item:
  declaration
  unlabeled-statement
  label

(6.8.3) expression-statement:
         expression opt  ;
         attribute-specifier-sequence expression ;

(6.8.4) selection-statement:
  "if" ( expression ) secondary-block
  "if" ( expression ) secondary-block else secondary-block
  "switch" ( expression ) secondary-block

(6.8.5) iteration-statement:
  "while" ( expression ) secondary-block
  "do" secondary-block "while" ( expression ) ;
  "for" ( expression opt  ; expression opt  ; expression opt  ) secondary-block
  "for" ( declaration expression opt  ; expression opt  ) secondary-block

(6.8.6) jump-statement:
  "goto" identifier ;
  "continue" ;
  "break" ;
  "return" expression opt  ;


(6.9) translation-unit:
  external-declaration
  translation-unit external-declaration

(6.9) external-declaration:
   function-definition
   declaration

(6.9.1) function-definition:
   attribute-specifier-sequence opt  declaration-specifiers declarator function-body

(6.9.1) function-body:
   compound-statement

(6.10) preprocessing-file:
   group opt

(6.10) group:
  group-part
  group group-part

(6.10) group-part:
  if-section
  control-line
  text-line
  # non-directive

(6.10) if-section:
  if-group elif-groups opt  else-group opt  endif-line

(6.10) if-group:
  # "if" constant-expression new-line group opt
  # "ifdef" identifier new-line group opt  # ifndef identifier new-line group opt

(6.10) elif-groups:
  elif-group
  elif-groups elif-group

(6.10) elif-group:
  # "elif" constant-expression new-line group opt
  # "elifdef" identifier new-line group opt
  # "elifndef" identifier new-line group opt

(6.10) else-group:
  # "else" new-line group opt

(6.10) endif-line:
  # "endif" new-line

(6.10) control-line:
 # "include" pp-tokens new-line
 # "embed" pp-tokens new-line
 # "define" identifier replacement-list new-line
 # "define" identifier lparen identifier-list opt  ) replacement-list new-line
 # "define" identifier lparen ... ) replacement-list new-line
 # "define" identifier lparen identifier-list , ... ) replacement-list new-line
 # "undef" identifier new-line
 # "line" pp-tokens new-line
 # "error" pp-tokens opt  new-line
 # "warning" pp-tokens opt  new-line
 # "pragma" pp-tokens opt  new-line
 # new-line

(6.10) text-line:
  pp-tokens opt  new-line

(6.10) non-directive:
  pp-tokens new-line

(6.10) lparen:
  /*a ( character not immediately preceded by white space*/

(6.10) replacement-list:
  pp-tokens opt

(6.10) pp-tokens:
  preprocessing-token
  pp-tokens preprocessing-token

(6.10) new-line:
  /*the new-line character*/

(6.10) identifier-list:
  identifier
  identifier-list , identifier

(6.10) pp-parameter:
  pp-parameter-name pp-parameter-clause opt

(6.10) pp-parameter-name:
  pp-standard-parameter
  pp-prefixed-parameter

(6.10) pp-standard-parameter:
   identifier

(6.10) pp-prefixed-parameter:
  identifier :: identifier

(6.10) pp-parameter-clause:
  ( pp-balanced-token-sequence opt  )

(6.10) pp-balanced-token-sequence:
  pp-balanced-token
  pp-balanced-token-sequence pp-balanced-token

(6.10) pp-balanced-token:
  ( pp-balanced-token-sequence opt  )
  [ pp-balanced-token-sequence opt  ]
  { pp-balanced-token-sequence opt  }
  /*any pp-token other than a parenthesis, a bracket, or a brace*/

(6.10) embed-parameter-sequence:
  pp-parameter
  embed-parameter-sequence pp-parameter

defined-macro-expression:
 "defined" identifier
 "defined" ( identifier )

h-preprocessing-token:
  /*any preprocessing-token other than >*/

h-pp-tokens:
  h-preprocessing-token
  h-pp-tokens h-preprocessing-token

header-name-tokens:
  string-literal
  < h-pp-tokens >

has-include-expression:
  "__has_include" ( header-name )
  "__has_include" ( header-name-tokens )

has-embed-expression:
  "__has_embed" ( header-name embed-parameter-sequence opt  )
  "__has_embed" ( header-name-tokens pp-balanced-token-sequence opt  )

has-c-attribute-express:
  "__has_c_attribute" ( pp-tokens )

va-opt-replacement:
 "__VA_OPT__" ( pp-tokens opt  )

(6.10.7) standard-pragma:
 # "pragma" "STDC" "FP_CONTRACT" on-off-switch
# "pragma" "STDC" "FENV_ACCESS on-off-switch
# "pragma" "STDC" "FENV_DEC_ROUND dec-direction
# "pragma" "STDC" "FENV_ROUND direction
# "pragma" "STDC" "CX_LIMITED_RANGE on-off-switch

(6.10.7) on-off-switch: one of
	"ON"	"OFF"	"DEFAULT"

(6.10.7) direction: one of
  "FE_DOWNWARD" "FE_TONEAREST" "FE_TONEARESTFROMZERO"
  "FE_TOWARDZERO" "FE_UPWARD" "FE_DYNAMIC"

(6.10.7) dec-direction: one of
  "FE_DEC_DOWNWARD" "FE_DEC_TONEAREST" "FE_DEC_TONEARESTFROMZERO"
  "FE_DEC_TOWARDZERO" "FE_DEC_UPWARD" "FE_DEC_DYNAMIC"


(7.24.1.5) n-char-sequence:
  digit
  nondigit
  n-char-sequence digit
  n-char-sequence nondigit


(7.31.4.1.2) n-wchar-sequence:
   digit
   nondigit
   n-wchar-sequence digit
   n-wchar-sequence nondigit


(7.24.1.6) d-char-sequence:
   digit
   nondigit
   d-char-sequence digit
   d-char-sequence nondigit

(7.31.4.1.3) d-wchar-sequence:
   digit
   nondigit
   d-wchar-sequence digit
   d-wchar-sequence nondigit