Annex A (informative) Grammar summary [gram] (original) (raw)

A.1 General [gram.general]

This summary of C++ grammar is intended to be an aid to comprehension.

It is not an exact statement of the language.

In particular, the grammar described here accepts a superset of valid C++ constructs.

Further, access control, ambiguity, and type rules are used to weed out syntactically valid but meaningless constructs.

A.3 Lexical conventions [gram.lex]

h-char:
any member of the source character set except new-line and >

q-char:
any member of the source character set except new-line and "

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 _

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

keyword:
any identifier listed in Table 5
import-keyword
module-keyword
export-keyword

operator-or-punctuator: one of
{ } [ ] ( )
<: :> <% %> ; : ...
? :: . .* -> ->* ~
! + - * / % ^ & |
= += -= *= /= %= ^= &= |=
== != < > <= >= <=> && ||
<< >> <<= >>= ++ -- ,
and or xor not bitand bitor compl
and_eq or_eq xor_eq not_eq

r-char:
any member of the source character set, except a right parenthesis ) followed by
the initial d-char-sequence (which may be empty) followed by a double quote ".

d-char:
any member of the basic source character set except:
space, the left parenthesis (, the right parenthesis ), the backslash \, and the control characters
representing horizontal tab, vertical tab, form feed, and newline.

A.5 Expressions [gram.expr]

fold-operator: one of

A.10 Overloading [gram.over]

operator: one of
new delete new[] delete[] co_await ( ) [ ] -> ->*
~ ! + - * / % ^ &
| = += -= *= /= %= ^= &=
|= == != < > <= >= <=> &&
|| << >> <<= >>= ++ -- ,

A.13 Preprocessing directives [gram.cpp]

lparen:
a ( character not immediately preceded by whitespace