next up previous
Next: Struct and union specifiers Up: The Abstract Syntax Tree Previous: Expressions


Declarations

A declaration begins with a sequence of specifiers that indicate the linkage, storage duration, and part of the type of the entities being declared. If a type is not completely described by the specifiers, the remaining information is provided by each declarator.

The declaration of a ForwardTag, described in Section 6.5.2.3 of the standard, has implications for the name analysis task that are very different from those of any other declaration. Representing this case by its own context simplifies the semantic analysis task.

AST nodes[9]:

RULE: declaration     ::=    Specifiers init_declarator_list_opt ';' END;
RULE: declaration     ::=    struct_or_union ForwardDef ';'          END;

RULE: Specifiers      LISTOF Specifier                               END;

RULE: init_declarator_list_opt
                      LISTOF init_declarator                         END;
RULE: init_declarator ::=    InitDecl                                END;
RULE: init_declarator ::=    InitDecl '=' initializer                END;
RULE: InitDecl        ::=    declarator                              END;
This macro is defined in definitions 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, and 18.
This macro is invoked in definition 1.

Storage specifiers, type specifiers, and type qualifiers are lumped together in this specification because they must be processed in the same way.

AST nodes[10]:

RULE: Specifier ::= 'typedef'                 END;
RULE: Specifier ::= 'extern'                  END;
RULE: Specifier ::= 'static'                  END;
RULE: Specifier ::= 'auto'                    END;
RULE: Specifier ::= 'register'                END;
RULE: Specifier ::= 'void'                    END;
RULE: Specifier ::= 'char'                    END;
RULE: Specifier ::= 'short'                   END;
RULE: Specifier ::= 'int'                     END;
RULE: Specifier ::= 'long'                    END;
RULE: Specifier ::= 'float'                   END;
RULE: Specifier ::= 'double'                  END;
RULE: Specifier ::= 'signed'                  END;
RULE: Specifier ::= 'unsigned'                END;
RULE: Specifier ::= struct_or_union_specifier END;
RULE: Specifier ::= enum_specifier            END;
RULE: Specifier ::= TypeIdUse                 END;
RULE: Specifier ::= 'const'                   END;
RULE: Specifier ::= 'volatile'                END;
This macro is defined in definitions 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, and 18.
This macro is invoked in definition 1.



Subsections
next up previous
Next: Struct and union specifiers Up: The Abstract Syntax Tree Previous: Expressions
2008-08-30