[an error occurred while processing this directive]

Grammatik der Programmiersprache C++ [] (C++ BNF C++ EBNF C++ Backus-Naur-Form), Grammatik, Seite 720896
https://www.purl.org/stefan_ram/pub/c++_grammatik_de ist die kanonische URI dieser Seite.
Stefan Ram

C++ -Grammatik

Diese Grammatik der Programmiersprache C++  ist noch unvollständig und wird im Laufe der Zeit erweitert.

This grammar of C++  is still incomplete. Work to extend it is in (slow) progress.

Keywords

typedef-name 〉 ::=
identifier 〉.
namespace-name 〉 ::=
original-namespace-name 〉 |
namespace-alias 〉.
original-namespace-name 〉 ::=
identifier 〉.
namespace-alias 〉 ::=
identifier 〉.
class-name 〉 ::=
identifier 〉 |
template-id 〉.
enum-name 〉 ::=
identifier 〉.
template-name 〉 ::=
identifier 〉.

Lexical Conventions

hex-quad 〉 ::=
hexadecimal-digit 〉 〈hexadecimal-digit 〉 〈hexadecimal-digit 〉 〈hexadecimal-digit 〉.
universal-character-name 〉 ::=
"\u" 〈hex-quad 〉 |
"
\U" 〈hex-quad 〉 〈hex-quad 〉.
preprocessing-token 〉 ::=
header-name 〉 |
identifier 〉 |
pp-number 〉 |
character-literal 〉 |
string-literal 〉 |
preprocessing-op-or-punc 〉 |
~〈
each non-white-space character that cannot be one of the above 〉.
token 〉 ::=
identifier 〉 |
keyword 〉 |
literal 〉 |
operator 〉 |
punctuator 〉.
header-name 〉 ::=
'<' 〈h-char-sequence 〉 '>' |
%d34 〈
q-char-sequence 〉 %d34.
h-char-sequence 〉 ::=
h-char 〉 |
h-char-sequence 〉 〈h-char 〉.
h-char 〉 ::=
~〈any member of the source character set except new-line and the greater-than sign 〉.
q-char-sequence 〉 ::=
q-char 〉 |
q-char-sequence 〉 〈q-char 〉.
q-char 〉 ::=
~〈any member of the source character set except new-line and the quotation mark 〉.
pp-number 〉 ::=
digit 〉 |
'
.' 〈digit 〉 |
pp-number 〉 〈digit 〉 |
pp-number 〉 〈nondigit 〉 |
pp-number 〉 'e' 〈sign 〉 |
pp-number 〉 'E' 〈sign 〉 |
pp-number 〉 '.'.
identifier 〉 ::=
nondigit 〉 |
identifier 〉 〈nondigit 〉 |
identifier 〉 〈digit 〉.
nondigit 〉 ::=
universal-character-name 〉 |
'
_' | '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 〉 ::=
'0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'.
postfix-expression 〉 ::=
primary-expression 〉 |
postfix-expression 〉 "[" 〈expression 〉 "]" |
postfix-expression 〉 "(" [〈expression-list 〉] ")" |
unary-expression 〉 ::=
postfix-expression 〉 |
"++" 〈cast-expression 〉 |
"--" 〈cast-expression 〉 |
unary-operator 〉 〈cast-expression 〉 |
"sizeof" 〈unary-expression 〉 |
"sizeof" "(" 〈type-id 〉 ")" |
new-expression 〉 |
delete-expression 〉.
unary-operator 〉 ::=
"*" | "&" | "+" | "-" | "!" | "~".
multiplicative-expression 〉 ::=
pm-expression 〉 |
multiplicative-expression 〉 "*" 〈pm-expression 〉 |
multiplicative-expression 〉 "/" 〈pm-expression 〉 |
multiplicative-expression 〉 "%" 〈pm-expression 〉.
additive-expression 〉 ::=
multiplicative-expression 〉 |
additive-expression 〉 "+" 〈multiplicative-expression 〉 |
additive-expression 〉 "-" 〈multiplicative-expression 〉.
logical-and-expression 〉 ::=
inclusive-or-expression 〉 |
logical-and-expression 〉 "&&" 〈inclusive-or-expression 〉.
logical-or-expression 〉 ::=
logical-and-expression 〉 |
logical-or-expression 〉 "||" 〈logical-and-expression 〉.
conditional-expression 〉 ::=
logical-or-expression 〉 |
logical-or-expression 〉 "?" 〈expression 〉 ":" 〈assignment-expression 〉.
assignment-expression 〉 ::=
conditional-expression 〉 |
logical-or-expression 〉 〈assignment-operator 〉 〈assignment-expression 〉 |
throw-expression 〉.
assignment-operator 〉 ::=
"=" | "*=" | "/=" | "%=" | "+=" | "­=" | ">>=" | "<<=" | "&=" | "^=" | "|=".
expression 〉 ::=
assignment-expression 〉 |
expression 〉 "," 〈assignmentexpression 〉.
statement 〉 ::=
labeled-statement 〉 |
expression-statement 〉 |
compound-statement 〉 |
selection-statement 〉 |
iteration-statement 〉 |
jump-statement 〉 |
declaration-statement 〉 |
try-block 〉.
expression-statement 〉 ::=
[〈expression 〉] ";".
simple-declaration 〉 ::=
[〈decl-specifier-seq 〉] [〈init-declarator-list 〉] ";".
decl-specifier 〉 ::=
storage-class-specifier 〉 |
type-specifier 〉 |
function-specifier 〉 |
"
friend" |
"
typedef".
decl-specifier-seq 〉 ::=
[〈decl-specifier-seq 〉] 〈decl-specifier 〉.
storage-class-specifier 〉 ::=
"auto" |
"
register" |
"
static" |
"
extern" |
"
mutable".
type-specifier 〉 ::=
simple-type-specifier 〉 |
class-specifier 〉 |
enum-specifier 〉 |
elaborated-type-specifier 〉 |
cv-specifier 〉.
simple-type-specifier 〉 ::=
["::"] [〈nested-name-specifier 〉] 〈type-name 〉 |
["
::"] 〈nested-name-specifier 〉 "template" 〈template-id 〉 |
"
char" |
"
wchar_t" |
"
bool" |
"
short" |
"
int" |
"
long" |
"
signed" |
"
unsigned" |
"
float" |
"
double" |
"
void".
init-declarator-list 〉 ::=
init-declarator 〉 |
init-declarator-list 〉 "," 〈init-declarator 〉.
init-declarator 〉 ::=
declarator 〉 [〈initializer 〉].
cv-qualifier 〉 ::=
"const" |
"
volatile".

7 Declarators

function-definition 〉 ::=
[〈decl-specifier-seq 〉] 〈declarator 〉 [〈ctor-initializer 〉] 〈function-body 〉.
function-definition 〉 ::=
[〈decl-specifier-seq 〉] 〈declarator 〉 〈function-try-block 〉.
function-body 〉 ::=
compoundstatement 〉.
initializer 〉 ::=
initializer-clause 〉 |
"
(" 〈expression-list 〉 ")".
class-specifier 〉 ::=
class-head 〉 "{" [〈member-specification 〉] "}".
access-specifier 〉 ::=
"private" |
"
protected" |
"
public".
control-line 〉 ::=
"#" "define" 〈identifier 〉 〈replacement-list 〉 〈new-line 〉.
replacement-list 〉 ::=
[〈pp-tokens 〉].

Seiteninformationen und Impressum   |   Mitteilungsformular  |   "ram@zedat.fu-berlin.de" (ohne die Anführungszeichen) ist die Netzpostadresse von Stefan Ram.   |   Von der Stefan-Ram-Startseite ausgehend finden sich oft noch mehr Informationen zu Themen, die auf einer Seite angesprochen wurden. (Eine Verbindung zur Stefan-Ram-Startseite befindet sich ganz oben auf dieser Seite.)  |   Der Urheber dieses Textes ist Stefan Ram. Alle Rechte sind vorbehalten. Diese Seite ist eine Veröffentlichung von Stefan Ram. slrprd, PbclevtugFgrsnaEnz