Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
277 lines (277 sloc) 8.04 KB
A.2 Phrasestructuregrammar
A.2.1 Expressions
(6.5.1) primary-expression:
identifier
constant
string-literal
(expression )
(6.5.2) postfix-expression:
primary-expression
postfix-expression [expression ]
postfix-expression (argument-expression-listopt )
postfix-expression . identifier
postfix-expression ->identifier
postfix-expression ++
postfix-expression --
(type-name ){initializer-list }
(type-name ){initializer-list ,}
(6.5.2) argument-expression-list:
assignment-expression
argument-expression-list ,assignment-expression
(6.5.3) unary-expression:
postfix-expression
++unary-expression
--unary-expression
unary-operator cast-expression
sizeofunary-expression
sizeof (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
§A.2.1 Languagesyntax summary 409
ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007 WG14/N1256
(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
410 Languagesyntax summary §A.2.1
WG14/N1256 CommitteeDraft — Septermber 7, 2007 ISO/IEC 9899:TC3
(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
A.2.2 Declarations
(6.7) declaration:
declaration-specifiers init-declarator-listopt ;
(6.7) declaration-specifiers:
storage-class-specifier declaration-specifiersopt
type-specifier declaration-specifiersopt
type-qualifier declaration-specifiersopt
function-specifier declaration-specifiersopt
(6.7) init-declarator-list:
init-declarator
init-declarator-list ,init-declarator
(6.7) init-declarator:
declarator
declarator =initializer
(6.7.1) storage-class-specifier:
typedef
extern
static
auto
register
§A.2.2 Languagesyntax summary 411
ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007 WG14/N1256
(6.7.2) type-specifier:
void
char
short
int
long
float
double
signed
unsigned
_Bool
_Complex
struct-or-union-specifier *
enum-specifier
typedef-name
(6.7.2.1) struct-or-union-specifier:
struct-or-union identifieropt {struct-declaration-list }
struct-or-union identifier
(6.7.2.1) struct-or-union:
struct
union
(6.7.2.1) struct-declaration-list:
struct-declaration
struct-declaration-list struct-declaration
(6.7.2.1) struct-declaration:
specifier-qualifier-list struct-declarator-list ;
(6.7.2.1) specifier-qualifier-list:
type-specifier specifier-qualifier-listopt
type-qualifier specifier-qualifier-listopt
(6.7.2.1) struct-declarator-list:
struct-declarator
struct-declarator-list ,struct-declarator
(6.7.2.1) struct-declarator:
declarator
declaratoropt :constant-expression
412 Languagesyntax summary §A.2.2
WG14/N1256 CommitteeDraft — Septermber 7, 2007 ISO/IEC 9899:TC3
(6.7.2.2) enum-specifier:
enumidentifieropt {enumerator-list }
enumidentifieropt {enumerator-list ,}
enumidentifier
(6.7.2.2) enumerator-list:
enumerator
enumerator-list ,enumerator
(6.7.2.2) enumerator:
enumeration-constant
enumeration-constant =constant-expression
(6.7.3) type-qualifier:
const
restrict
volatile
(6.7.4) function-specifier:
inline
(6.7.5) declarator:
pointeropt direct-declarator
(6.7.5) direct-declarator:
identifier
(declarator )
direct-declarator[type-qualifier-listopt assignment-expressionopt ]
direct-declarator[statictype-qualifier-listopt assignment-expression]
direct-declarator[type-qualifier-list staticassignment-expression]
direct-declarator[type-qualifier-listopt *]
direct-declarator(parameter-type-list)
direct-declarator(identifier-listopt )
(6.7.5) pointer:
*type-qualifier-listopt
*type-qualifier-listopt pointer
(6.7.5) type-qualifier-list:
type-qualifier
type-qualifier-list type-qualifier
(6.7.5) parameter-type-list:
parameter-list
parameter-list ,...
§A.2.2 Languagesyntax summary 413
ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007 WG14/N1256
(6.7.5) parameter-list:
parameter-declaration
parameter-list ,parameter-declaration
(6.7.5) parameter-declaration:
declaration-specifiers declarator
declaration-specifiers abstract-declaratoropt
(6.7.5) identifier-list:
identifier
identifier-list ,identifier
(6.7.6) type-name:
specifier-qualifier-list abstract-declaratoropt
(6.7.6) abstract-declarator:
pointer
pointeropt direct-abstract-declarator
(6.7.6) direct-abstract-declarator:
(abstract-declarator )
direct-abstract-declaratoropt [type-qualifier-listopt
assignment-expressionopt ]
direct-abstract-declaratoropt [ static type-qualifier-listopt
assignment-expression ]
direct-abstract-declaratoropt [type-qualifier-list static
assignment-expression ]
direct-abstract-declaratoropt [* ]
direct-abstract-declaratoropt (parameter-type-listopt )
(6.7.7) typedef-name:
identifier
(6.7.8) initializer:
assignment-expression
{initializer-list }
{initializer-list ,}
(6.7.8) initializer-list:
designationopt initializer
initializer-list ,designationopt initializer
(6.7.8) designation:
designator-list =
414 Languagesyntax summary §A.2.2
WG14/N1256 CommitteeDraft — Septermber 7, 2007 ISO/IEC 9899:TC3
(6.7.8) designator-list:
designator
designator-list designator
(6.7.8) designator:
[constant-expression ]
.identifier
A.2.3 Statements
(6.8) statement:
labeled-statement
compound-statement
expression-statement
selection-statement
iteration-statement
jump-statement
(6.8.1) labeled-statement:
identifier :statement
caseconstant-expression :statement
default :statement
(6.8.2) compound-statement:
{block-item-listopt }
(6.8.2) block-item-list:
block-item
block-item-list block-item
(6.8.2) block-item:
declaration
statement
(6.8.3) expression-statement:
expressionopt ;
(6.8.4) selection-statement:
if (expression )statement
if (expression )statement elsestatement
switch (expression )statement
§A.2.3 Languagesyntax summary 415
ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007 WG14/N1256
(6.8.5) iteration-statement:
while ( expression )statement
dostatement while (expression );
for (expressionopt ;expressionopt ;expressionopt )statement
for (declaration expressionopt ;expressionopt )statement
(6.8.6) jump-statement:
gotoidentifier ;
continue ;
break ;
returnexpressionopt ;
A.2.4 External definitions
(6.9) translation-unit:
external-declaration
translation-unit external-declaration
(6.9) external-declaration:
function-definition
declaration
(6.9.1) function-definition:
declaration-specifiers declarator declaration-listopt compound-statement
(6.9.1) declaration-list:
declaration
declaration-list declaration