next up previous
Next: External definitions Up: The Abstract Syntax Tree Previous: Initialization

Statements

AST nodes[16]:

RULE: statement ::= LabelDef ':' statement                                 END;
RULE: statement ::= 'case' constant_expression ':' statement               END;
RULE: statement ::= 'default' ':' statement                                END;

RULE: statement ::= compound_statement                                     END;
RULE: compound_statement
                ::= '{' body '}'                                           END;
RULE: body   LISTOF declaration | statement                                END;

RULE: statement ::= Expression ';'                                         END;
RULE: statement ::=            ';'                                         END;

RULE: statement ::= 'if' '(' Expression ')' statement 'else' statement     END;
RULE: statement ::= 'if' '(' Expression ')' statement                      END;
RULE: statement ::= switch_statement                                       END;
RULE: switch_statement ::= 'switch' '(' Expression ')' statement           END;

RULE: statement ::= iteration_statement                                    END;
RULE: iteration_statement
                ::= 'while' '(' Expression ')' statement                   END;
RULE: iteration_statement
                ::= 'do' statement 'while' '(' Expression ')' ';'          END;
RULE: iteration_statement
                ::= 'for' '(' Exp1or3 ';' Exp2 ';' Exp1or3 ')' statement   END;

RULE: Exp1or3   ::= Expression                                             END;
RULE: Exp1or3   ::=                                                        END;
RULE: Exp2      ::= Expression                                             END;
RULE: Exp2      ::=                                                        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.

Section 6.6.5.3 of the standard says that both the initializer and the step Of a for statement may be omitted. Each is then evaluated as a void expression. An omitted condition is replaced by a nonzero constant. These distinct semantics are embodied in specific tree contexts.

AST nodes[17]:

RULE: statement ::= 'goto' LabelUse     ';' END;
RULE: statement ::= 'continue'          ';' END;
RULE: statement ::= 'break'             ';' END;
RULE: statement ::= 'return'            ';' END;
RULE: statement ::= 'return' Expression ';' 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.


next up previous
Next: External definitions Up: The Abstract Syntax Tree Previous: Initialization
2008-08-30