TranslationUnit | → | ExternalDecl |
| | | TranslationUnit ExternalDecl |
ExternalDecl | → | FunctionDefinition |
| | | Decl |
FunctionDefinition | → | DeclSpecs Declarator DeclList CompoundStat |
| | | Declarator DeclList CompoundStat |
| | | DeclSpecs Declarator CompoundStat |
| | | Declarator CompoundStat |
Decl | → | DeclSpecs InitDeclaratorList ; |
| | | DeclSpecs ; |
DeclList | → | Decl |
| | | DeclList Decl |
DeclSpecs | → | StorageClassSpec DeclSpecs |
| | | StorageClassSpec |
| | | TypeSpec DeclSpecs |
| | | TypeSpec |
| | | TypeQualifier DeclSpecs |
| | | TypeQualifier |
StorageClassSpec | → | auto | register | static | extern | typedef |
TypeSpec | → | void | char | short | int | long | float
| double | signed | unsigned |
| | | StructOrUnionSpec | EnumSpec | TypedefName |
TypeQualifier | → | const | volatile |
StructOrUnionSpec | → | StructOrUnion Id { StructDeclList } |
| | | StructOrUnion { StructDeclList } |
| | | StructOrUnion Id |
StructOrUnion | → | struct | union |
StructDeclList | → | StructDecl |
| | | StructDeclList StructDecl |
InitDeclaratorList | → | InitDeclarator |
| | | InitDeclaratorList , InitDeclarator |
InitDeclarator | → | Declarator |
| | | Declarator = Initializer |
StructDecl | → | SpecQualifierList StructDeclaratorList ; |
SpecQualifierList | → | TypeSpec SpecQualifierList |
| | | TypeSpec |
| | | TypeQualifier SpecQualifierList |
| | | TypeQualifier |
StructDeclaratorList | → | StructDeclarator |
| | | StructDeclaratorList , StructDeclarator |
StructDeclarator | → | Declarator |
| | | Declarator : ConstExp |
| | | : ConstExp |
EnumSpec | → | enum Id { EnumeratorList } |
| | | enum { EnumeratorList } |
| | | enum Id |
EnumeratorList | → | Enumerator |
| | | EnumeratorList , Enumerator |
Enumerator | → | Id |
| | | Id = ConstExp |
Declarator | → | Pointer DirectDeclarator |
| | | DirectDeclarator |
DirectDeclarator | → | Id |
| | | ( Declarator ) |
| | | DirectDeclarator [ ConstExp ] |
| | | DirectDeclarator [ ] |
| | | DirectDeclarator ( ParamTypeList ) |
| | | DirectDeclarator ( IdList ) |
| | | DirectDeclarator ( ) |
Pointer | → | * TypeQualifierList |
| | | * |
| | | * TypeQualifierList Pointer |
| | | * Pointer |
TypeQualifierList | → | TypeQualifier |
| | | TypeQualifierList TypeQualifier |
ParamTypeList | → | ParamList |
| | | ParamList , ... |
ParamList | → | ParamDecl |
| | | ParamList , ParamDecl |
ParamDecl | → | DeclSpecs Declarator |
| | | DeclSpecs AbstractDeclarator |
| | | DeclSpecs |
IdList | → | Id |
| | | IdList , Id |
Initializer | → | AssignmentExp |
| | | { InitializerList } |
| | | { InitializerList , } |
InitializerList | → | Initializer |
| | | InitializerList , Initializer |
TypeName | → | SpecQualifierList AbstractDeclarator |
| | | SpecQualifierList |
AbstractDeclarator | → | Pointer |
| | | Pointer DirectAbstractDeclarator |
| | | DirectAbstractDeclarator |
DirectAbstractDeclarator | → | ( AbstractDeclarator ) |
| | | DirectAbstractDeclarator [ ConstExp ] |
| | | [ ConstExp ] |
| | | DirectAbstractDeclarator [ ] |
| | | [ ] |
| | | DirectAbstractDeclarator ( ParamTypeList ) |
| | | ( ParamTypeList ) |
| | | DirectAbstractDeclarator ( ) |
| | | ( ) |
TypedefName | → | Id |
Stat | → | LabeledStat | ExpStat | CompoundStat | SelectionStat |
IterationStat | JumpStat |
LabeledStat | → | Id : Stat |
| | | case ConstExp : Stat |
| | | default : Stat |
ExpStat | → | Exp ; |
| | | ; |
CompoundStat | → | { DeclList StatList } |
| | | { StatList } |
| | | { DeclList } |
| | | { } |
StatList | → | Stat |
| | | StatList Stat |
SelectionStat | → | if ( Exp ) Stat |
| | | if ( Exp ) Stat else Stat |
| | | switch ( Exp ) Stat |
IterationStat | → | while ( Exp ) Stat |
| | | do Stat while ( Exp ) ; |
| | | for ( Exp ; Exp ; Exp ) Stat |
| | | for ( Exp ; Exp ; ) Stat |
| | | for ( Exp ; ; Exp ) Stat |
| | | for ( Exp ; ; ) Stat |
| | | for ( ; Exp ; Exp ) Stat |
| | | for ( ; Exp ; ) Stat |
| | | for ( ; ; Exp ) Stat |
| | | for ( ; ; ) Stat |
JumpStat | → | JumpSpec ; |
JumpSpec | → | goto Id | continue | break | return Exp | return |
Exp | → | AssignmentExp |
| | | Exp , AssignmentExp |
AssignmentExp | → | ConditionalExp |
| | | UnaryExp AssignmentOperator AssignmentExp |
AssignmentOperator | → | = | *= | /= | %= | += | -= | <<= |
>>= | &= | ^= | |= |
ConditionalExp | → | LogicalOrExp |
| | | LogicalOrExp ? Exp : ConditionalExp |
ConstExp | → | ConditionalExp |
LogicalOrExp | → | LogicalAndExp |
| | | LogicalOrExp || LogicalAndExp |
LogicalAndExp | → | InclusiveOrExp |
| | | LogicalAndExp && InclusiveOrExp |
InclusiveOrExp | → | ExclusiveOrExp |
| | | InclusiveOrExp | ExclusiveOrExp |
ExclusiveOrExp | → | AndExp |
| | | ExclusiveOrExp ^ AndExp |
AndExp | → | EqualityExp |
| | | AndExp & EqualityExp |
EqualityExp | → | RelationalExp |
| | | EqualityExp == RelationalExp |
| | | EqualityExp != RelationalExp |
RelationalExp | → | ShiftExpression |
| | | RelationalExp < ShiftExpression |
| | | RelationalExp > ShiftExpression |
| | | RelationalExp <= ShiftExpression |
| | | RelationalExp >= ShiftExpression |
ShiftExpression | → | AdditiveExp |
| | | ShiftExpression << AdditiveExp |
| | | ShiftExpression >> AdditiveExp |
AdditiveExp | → | MultExp |
| | | AdditiveExp + MultExp |
| | | AdditiveExp - MultExp |
MultExp | → | CastExp |
| | | MultExp * CastExp |
| | | MultExp / CastExp |
| | | MultExp % CastExp |
CastExp | → | UnaryExp |
| | | ( TypeName ) CastExp |
UnaryExp | → | PostfixExp |
| | | ++ UnaryExp |
| | | -- UnaryExp |
| | | UnaryOperator CastExp |
| | | sizeof UnaryExp |
| | | sizeof ( TypeName ) |
UnaryOperator | → | & | * | + | - | ~ | ! |
PostfixExp | → | PrimaryExp |
| | | PostfixExp [ Exp ] |
| | | PostfixExp ( ArgumentExpList ) |
| | | PostfixExp ( ) |
| | | PostfixExp . Id |
| | | PostfixExp -> Id |
| | | PostfixExp ++ |
| | | PostfixExp -- |
PrimaryExp | → | Id | IntConst | FloatConst |
EnumerationConst | StringConst |
( Exp ) |
ArgumentExpList | → | AssignmentExp |
| | | ArgumentExpList , AssignmentExp |