Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
614 lines (613 sloc) 15.7 KB
A.3 Basic concepts [gram.basic]
translation-unit:
declaration-seqopt
§ A.3 1089
c
⃝ ISO/IEC N2723=08-0233
A.4 Expressions [gram.expr]
primary-expression:
literal
this
( expression )
id-expression
lambda-expression
id-expression:
unqualified-id
qualified-id
unqualified-id:
identifier
operator-function-id
conversion-function-id
∼ class-name
template-id
qualified-id:
::opt nested-name-specifier templateopt unqualified-id
:: identifier
:: operator-function-id
:: template-id
nested-name-specifier:
type-name ::
namespace-name ::
nested-name-specifier identifier ::
nested-name-specifier templateopt simple-template-id ::
lambda-expression:
lambda-introducer lambda-parameter-declarationopt compound-statement
lambda-introducer:
[ lambda-captureopt ]
lambda-capture:
capture-default
capture-list
capture-default , capture-list
capture-default:
&
=
capture-list:
capture
capture-list , capture
capture:
identifier
& identifier
this
lambda-parameter-declaration:
( lambda-parameter-declaration-listopt )
mutableopt exception-specificationopt lambda-return-type-clauseopt
lambda-parameter-declaration-list:
lambda-parameter
lambda-parameter , lambda-parameter-declaration-list
§ A.4 1090
c
⃝ ISO/IEC N2723=08-0233
lambda-parameter:
decl-specifier-seq declarator
lambda-return-type-clause:
-> type-id
postfix-expression:
primary-expression
postfix-expression [ expression ]
postfix-expression [ braced-init-list ]
postfix-expression ( expression-listopt )
simple-type-specifier ( expression-listopt )
typename-specifier ( expression-listopt )
simple-type-specifier braced-init-list
typename-specifier braced-init-list
postfix-expression . templateopt id-expression
postfix-expression -> templateopt id-expression
postfix-expression . pseudo-destructor-name
postfix-expression -> pseudo-destructor-name
postfix-expression ++
postfix-expression --
dynamic_cast < type-id > ( expression )
static_cast < type-id > ( expression )
reinterpret_cast < type-id > ( expression )
const_cast < type-id > ( expression )
typeid ( expression )
typeid ( type-id )
expression-list:
initializer-list
pseudo-destructor-name:
::opt nested-name-specifieropt type-name ::
∼ type-name
::opt nested-name-specifier template simple-template-id ::
∼ type-name
::opt nested-name-specifieropt
∼ type-name
unary-expression:
postfix-expression
++ cast-expression
-- cast-expression
unary-operator cast-expression
sizeof unary-expression
sizeof ( type-id )
sizeof ... ( identifier )
alignof ( type-id )
new-expression
delete-expression
unary-operator: one of
* & + - !
new-expression:
::opt new new-placementopt new-type-id new-initializeropt
::opt new new-placementopt ( type-id ) new-initializeropt
new-placement:
( expression-list )
new-type-id:
type-specifier-seq new-declaratoropt
§ A.4 1091
c
⃝ ISO/IEC N2723=08-0233
new-declarator:
ptr-operator new-declaratoropt
direct-new-declarator
direct-new-declarator:
[ expression ]
direct-new-declarator [ constant-expression ]
new-initializer:
( expression-listopt )
braced-init-list
delete-expression:
::opt delete cast-expression
::opt delete [ ] cast-expression
cast-expression:
unary-expression
( type-id ) cast-expression
pm-expression:
cast-expression
pm-expression .* cast-expression
pm-expression ->* cast-expression
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
shift-expression:
additive-expression
shift-expression << additive-expression
shift-expression >> additive-expression
relational-expression:
shift-expression
relational-expression < shift-expression
relational-expression > shift-expression
relational-expression <= shift-expression
relational-expression >= shift-expression
equality-expression:
relational-expression
equality-expression == relational-expression
equality-expression != relational-expression
and-expression:
equality-expression
and-expression & equality-expression
exclusive-or-expression:
and-expression
exclusive-or-expression ˆ and-expression
§ A.4 1092
c
⃝ ISO/IEC N2723=08-0233
inclusive-or-expression:
exclusive-or-expression
inclusive-or-expression | exclusive-or-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 initializer-clause
throw-expression
assignment-operator: one of
= *= /= %= += -= >>= <<= &= ˆ= |=
expression:
assignment-expression
expression , assignment-expression
constant-expression:
conditional-expression
A.5 Statements [gram.stmt]
statement:
labeled-statement
expression-statement
compound-statement
selection-statement
iteration-statement
jump-statement
declaration-statement
try-block
labeled-statement:
identifier : statement
case constant-expression : statement
default : statement
expression-statement:
expressionopt ;
compound-statement:
{ statement-seqopt }
statement-seq:
statement
statement-seq statement
selection-statement:
if ( condition ) statement
if ( condition ) statement else statement
switch ( condition ) statement
§ A.5 1093
c
⃝ ISO/IEC N2723=08-0233
condition:
expression
type-specifier-seq declarator = initializer-clause
type-specifier-seq declarator braced-init-list
iteration-statement:
while ( condition ) statement
do statement while ( expression ) ;
for ( for-init-statement conditionopt ; expressionopt ) statement
for-init-statement:
expression-statement
simple-declaration
jump-statement:
break ;
continue ;
return expressionopt ;
return braced-init-list ;
goto identifier ;
declaration-statement:
block-declaration
A.6 Declarations [gram.dcl]
declaration-seq:
declaration
declaration-seq declaration
declaration:
block-declaration
function-definition
template-declaration
explicit-instantiation
explicit-specialization
linkage-specification
namespace-definition
block-declaration:
simple-declaration
asm-definition
namespace-alias-definition
using-declaration
using-directive
static_assert-declaration
alias-declaration
alias-declaration:
using identifier = type-id ;
simple-declaration:
decl-specifier-seqopt init-declarator-listopt ;
static_assert-declaration:
static_assert ( constant-expression , string-literal ) ;
§ A.6 1094
c
⃝ ISO/IEC N2723=08-0233
decl-specifier:
storage-class-specifier
type-specifier
function-specifier
friend
typedef
constexpr
alignment-specifier
decl-specifier-seq:
decl-specifier-seqopt decl-specifier
storage-class-specifier:
register
static
thread_local
extern
mutable
function-specifier:
inline
virtual
explicit
typedef-name:
identifier
type-specifier:
simple-type-specifier
class-specifier
enum-specifier
elaborated-type-specifier
typename-specifier
cv-qualifier
type-specifier-seq:
type-specifier type-specifier-seqopt
simple-type-specifier:
::opt nested-name-specifieropt type-name
::opt nested-name-specifier template simple-template-id
char
char16_t
char32_t
wchar_t
bool
short
int
long
signed
unsigned
float
double
void
auto
decltype ( expression )
type-name:
class-name
enum-name
typedef-name
§ A.6 1095
c
⃝ ISO/IEC N2723=08-0233
elaborated-type-specifier:
class-key ::opt nested-name-specifieropt identifier
class-key ::opt nested-name-specifieropt templateopt simple-template-id
enum-key ::opt nested-name-specifieropt identifier
alignment-specifier:
alignas ( constant-expression )
alignas ( type-id )
enum-name:
identifier
enum-specifier:
enum-key identifieropt enum-baseopt { enumerator-listopt }
enum-key identifieropt enum-baseopt { enumerator-list , }
enum-key:
enum
enum class
enum struct
enum-base:
: type-specifier-seq
enumerator-list:
enumerator-definition
enumerator-list , enumerator-definition
enumerator-definition:
enumerator
enumerator = constant-expression
enumerator:
identifier
namespace-name:
original-namespace-name
namespace-alias
original-namespace-name:
identifier
namespace-definition:
named-namespace-definition
unnamed-namespace-definition
named-namespace-definition:
original-namespace-definition
extension-namespace-definition
original-namespace-definition:
inlineopt namespace identifier { namespace-body }
extension-namespace-definition:
inlineopt namespace original-namespace-name { namespace-body }
unnamed-namespace-definition:
inlineopt namespace { namespace-body }
namespace-body:
declaration-seqopt
namespace-alias:
identifier
namespace-alias-definition:
namespace identifier = qualified-namespace-specifier ;
qualified-namespace-specifier:
::opt nested-name-specifieropt namespace-name
using-declaration:
using typenameopt ::opt nested-name-specifier unqualified-id ;
using :: unqualified-id ;
§ A.6 1096
c
⃝ ISO/IEC N2723=08-0233
using-directive:
using namespace ::opt nested-name-specifieropt namespace-name ;
asm-definition:
asm ( string-literal ) ;
linkage-specification:
extern string-literal { declaration-seqopt }
extern string-literal declaration
A.7 Declarators [gram.decl]
init-declarator-list:
init-declarator
init-declarator-list , init-declarator
init-declarator:
declarator initializeropt
declarator:
direct-declarator
ptr-operator declarator
direct-declarator:
declarator-id
direct-declarator ( parameter-declaration-clause )
cv-qualifier-seqopt ref-qualifieropt exception-specificationopt
direct-declarator ( parameter-declaration-clause )
cv-qualifier-seqopt ref-qualifieropt exception-specificationopt -> type-id
direct-declarator [ constant-expressionopt ]
( declarator )
ptr-operator:
* cv-qualifier-seqopt
&
&&
::opt nested-name-specifier * cv-qualifier-seqopt
cv-qualifier-seq:
cv-qualifier cv-qualifier-seqopt
cv-qualifier:
const
volatile
ref-qualifier:
&
&&
declarator-id:
...opt id-expression
::opt nested-name-specifieropt class-name
type-id:
type-specifier-seq abstract-declaratoropt
abstract-declarator:
ptr-operator abstract-declaratoropt
direct-abstract-declarator
...
§ A.7 1097
c
⃝ ISO/IEC N2723=08-0233
direct-abstract-declarator:
direct-abstract-declaratoropt ( parameter-declaration-clause )
cv-qualifier-seqopt ref-qualifieropt exception-specificationopt
direct-abstract-declaratoropt ( parameter-declaration-clause )
cv-qualifier-seqopt ref-qualifieropt exception-specificationopt -> type-id
direct-abstract-declaratoropt [ constant-expressionopt ]
( abstract-declarator )
parameter-declaration-clause:
parameter-declaration-listopt ...opt
parameter-declaration-list , ...
parameter-declaration-list:
parameter-declaration
parameter-declaration-list , parameter-declaration
parameter-declaration:
decl-specifier-seq declarator
decl-specifier-seq declarator = assignment-expression
decl-specifier-seq abstract-declaratoropt
decl-specifier-seq abstract-declaratoropt = assignment-expression
function-definition:
decl-specifier-seqopt declarator function-body
decl-specifier-seqopt declarator = default ;
decl-specifier-seqopt declarator = delete ;
function-body:
ctor-initializeropt compound-statement
function-try-block
initializer:
= initializer-clause
( expression-list )
braced-init-list
initializer-clause:
assignment-expression
braced-init-list
initializer-list:
initializer-clause ...opt
initializer-list , initializer-clause ...opt
braced-init-list:
{ initializer-list ,opt }
{ }
A.8 Classes [gram.class]
class-name:
identifier
simple-template-id
class-specifier:
class-head { member-specificationopt }
class-head:
class-key identifieropt base-clauseopt
class-key nested-name-specifier identifier base-clauseopt
class-key nested-name-specifieropt simple-template-id base-clauseopt
§ A.8 1098
c
⃝ ISO/IEC N2723=08-0233
class-key:
class
struct
union
member-specification:
member-declaration member-specificationopt
access-specifier : member-specificationopt
member-declaration:
decl-specifier-seqopt member-declarator-listopt ;
function-definition ;opt
::opt nested-name-specifier templateopt unqualified-id ;
using-declaration
static_assert-declaration
template-declaration
member-declarator-list:
member-declarator
member-declarator-list , member-declarator
member-declarator:
declarator pure-specifieropt
declarator constant-initializeropt
identifieropt : constant-expression
pure-specifier:
= 0
constant-initializer:
= constant-expression
A.9 Derived classes [gram.derived]
base-clause:
: base-specifier-list
base-specifier-list:
base-specifier ...opt
base-specifier-list , base-specifier ...opt
base-specifier:
::opt nested-name-specifieropt class-name
virtual access-specifieropt ::opt nested-name-specifieropt class-name
access-specifier virtualopt ::opt nested-name-specifieropt class-name
access-specifier:
private
protected
public
A.10 Special member functions [gram.special]
conversion-function-id:
operator conversion-type-id
conversion-type-id:
type-specifier-seq conversion-declaratoropt
conversion-declarator:
ptr-operator conversion-declaratoropt
ctor-initializer:
: mem-initializer-list
§ A.10 1099
c
⃝ ISO/IEC N2723=08-0233
mem-initializer-list:
mem-initializer ...opt
mem-initializer , mem-initializer-list ...opt
mem-initializer:
mem-initializer-id ( expression-listopt )
mem-initializer-id braced-init-list
mem-initializer-id:
::opt nested-name-specifieropt class-name
identifier
A.11 Overloading [gram.over]
operator-function-id:
operator operator
operator: one of
new delete new[] delete[]
+ - * / % ˆ & |
! = < > += -= *= /= %=
ˆ= &= |= << >> >>= <<= == !=
<= >= && || ++ -- , ->* ->
( ) [ ]
A.12 Templates [gram.temp]
template-declaration:
exportopt template < template-parameter-list > declaration
template-parameter-list:
template-parameter
template-parameter-list , template-parameter
template-parameter:
type-parameter
parameter-declaration
type-parameter:
class ...opt identifieropt
class identifieropt = type-id
typename ...opt identifieropt
typename identifieropt = type-id
template < template-parameter-list > class ...opt identifieropt
template < template-parameter-list > class identifieropt = id-expression
simple-template-id:
template-name < template-argument-listopt >
template-id:
simple-template-id
operator-function-id < template-argument-listopt >
template-name:
identifier
template-argument-list:
template-argument ...opt
template-argument-list , template-argument ...opt
§ A.12 1100
c
⃝ ISO/IEC N2723=08-0233
template-argument:
constant-expression
type-id
id-expression
typename-specifier:
typename ::opt nested-name-specifier identifier
typename ::opt nested-name-specifier templateopt simple-template-id
explicit-instantiation:
externopt template declaration
explicit-specialization:
template < > declaration
A.13 Exception handling [gram.except]
try-block:
try compound-statement hand ler-seq
function-try-block:
try ctor-initializeropt compound-statement hand ler-seq
hand ler-seq:
hand ler hand ler-seqopt
hand ler:
catch ( exception-declaration ) compound-statement
exception-declaration:
type-specifier-seq declarator
type-specifier-seq abstract-declarator
type-specifier-seq
...
throw-expression:
throw assignment-expressionopt
exception-specification:
throw ( type-id-listopt )
type-id-list:
type-id ...opt
type-id-list , type-id ...opt