- translation-unit
external-declaration
translation-unit external-declaration
- external-declaration
function-definition
declaration
- function-definition
declaration-specifiers declarator compound-statement
-
declaration-specifiers declarator declaration-list compound-statement
The pre-standard way - declaration-list
declaration
declaration-list declaration
- declaration
declaration-specifiers init-declarator-listopt
-
static_assert-declaration
since C11 - declaration-specifiers
storage-class-specifier declaration-specifiersopt
type-specifier declaration-specifiersopt
type-qualifier declaration-specifiersopt
function-specifier declaration-specifiersopt
alignment-specifier declaration-specifiersopt
- init-declarator-list
init-declarator
init-declarator-list , init-declarator
- init-declarator
declarator
declarator = initializer
- storage-class-specifier
typedef
extern
static
_Thread_
local auto
register
- type-specifier
void
char
short
int
long
float
double
signed
unsigned
-
_Bool
since C99 -
_Complex
since C99 -
_Imaginary
since C99 -
atomic-type-specifier
since C11 struct-or-union-specifier
enum-specifier
typedef-name
- struct-or-union-specifier
struct-or-union identifieropt { struct-declaration-list }
struct-or-union identifier
- struct-or-union
struct
union
- struct-declaration-list
struct-declaration
struct-declaration-list struct-declaration
- struct-declaration
specifier-qualifier-list struct-declarator-listopt ;
-
static_assert-declaration
since C11 - specifier-qualifier-list
type-specifier specifier-qualifier-listopt
type-qualifier specifier-qualifier-listopt
- struct-declarator-list
struct-declarator
struct-declarator-list struct-declarator
- struct-declarator
declarator
declaratoropt : constant-expression
- enum-specifier
enum identifieropt { enumerator-list }
-
enum identifieropt { enumerator-list , }
since C99 enum identifier
- enumerator-list
enumerator
enumerator-list , enumerator
- enumerator
enumeration-constant
enumeration-constant = constant-expression
- atomic-type-specifier
_Atomic ( type-name )
- type-qualifier
const
restrict
volatile
_Atomic
- function-specifier
inline
_Noreturn
- alignment-specifier
_Alignas ( type-name )
_Alignas ( constant-expression )
- declarator
pointeropt direct-declarator
- direct-declarator
identifier
( declarator )
-
direct-declarator [ type-qualifier-listopt assignment-expressionopt ]
-
direct-declarator [ static type-qualifier-listopt assignment-expression ]
-
direct-declarator [ type-qualifier-list static assignment-expression ]
-
direct-declarator [ type-qualifier-listopt * ]
direct-declarator ( parameter-type-list )
-
direct-declarator ( identifier-listopt )
The pre-standard way - pointer
* type-qualifier-listopt
* type-qualifier-listopt pointer
- type-qualifier-list
type-qualifier
type-qualifier-list type-qualifier
- parameter-type-list
parameter-list
parameter-list , ...
- parameter-list
parameter-declaration
parameter-list , parameter-declaration
- parameter-declaration
declaration-specifiers declarator
declaration-specifiers abstract-declaratoropt
- identifier-list
identifier
identifier-list , identifier
- type-name
specifier-qualifier-list abstract-declaratoropt
- abstract-declarator
pointer
pointeropt direct-abstract-declarator
- 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 )
- typedef-name
identifier
- initializer
assignment-expression
{ initializer-list }
-
{ initializer-list , }
since C99 - initializer-list
designationopt initializer
initializer-list , designationopt initializer
- designation
designator-list =
- designator
-
[ constant-expression ]
. identifier
- static_assert-declaration
_Static_
assert ( constant-expression , string-literal ) ;- statement
goto-labelled-statement
switch-labelled-statement
compound-statement
null-statement
expression-statement
selection-statement
iteration-statement
jump-statement
- switch-labelled-statement
case constant-expression : statement
default : statement
- goto-labelled-statement
identifier : statement
- compound-statement
-
{ block-item-list }
since C99 -
{ declarationsopt statementsopt }
until C99 - block-item-list
block-item
block-item-list block-item
- block-item
declaration
statement
- expression-statement
expression ;
- selection-statement
if ( expression ) statement
if ( expression ) statement else statement
switch ( expression ) statement
- iteration-statement
while ( expression ) statement
do statement while ( expression ) ;
for ( expressionopt ; expressionopt ; expressionopt ) statement
-
for ( declaration expressionopt ; expressionopt ) statement
since C99 - jump-statement
goto identifier ;
continue ;
break ;
return expressionopt ;
- expression
assignment-expression
expression , assignment-expression
- assignment-expression
conditional-expression
unary-expression assignment-operator assignment-expression
- assignment-operator
=
*=
/=
%=
+=
-=
<<=
>>=
&=
^=
|=
- conditional-expression
logical-OR-expression
logical-OR-expression ? expression : conditional-expression
- logical-OR-expression
logical-AND-expression
logical-OR-expression || logical-AND-expression
- logical-AND-expression
inclusive-OR-expression
logical-AND-expression && inclusive-OR-expression
- inclusive-OR-expression
exclusive-OR-expression
inclusive-OR-expression | exclusive-OR-expression
- exclusive-OR-expression
AND-expression
exclusive-OR-expression ^ AND-expression
- AND-expression
equality-expression
AND-expression & equality-expression
- equality-expression
relational-expression
equality-expression == relational-expression
equality-expression != relational-expression
- relational-expression
shift-expression
relational-expression < shift-expression
relational-expression > shift-expression
relational-expression <= shift-expression
relational-expression >= shift-expression
- shift-expression
additive-expression
shift-expression << additive-expression
shift-expression >> additive-expression
- additive-expression
multiplicative-expression
additive-expression + multiplicative-expression
additive-expression - multiplicative-expression
- multiplicative-expression
cast-expression
multiplicative-expression * cast-expression
multiplicative-expression / cast-expression
multiplicative-expression % cast-expression
- cast-expression
unary-expression
( type-name ) cast-expression
- unary-expression
postfix-expression
-
++ unary-expression
-
-- unary-expression
unary-operator cast-expression
sizeof unary-expression
sizeof ( type-name )
_Alignof ( type-name )
- unary-operator
&
*
+
-
~
!
- postfix-expression
primary-expression
-
postfix-expression [ expression ]
-
postfix-expression ( argument-expression-listopt )
-
postfix-expression . identifier
Structures and Unions -
postfix-expression -> identifier
Structures and Unions -
postfix-expression ++
-
postfix-expression --
-
( type-name ) { initializer-list }
since C99; Structures -
( type-name ) { initializer-list , }
since C99; Structures - primary-expression
identifier
constant
string-literal
( expression )
-
generic-selection
since C11