- If statement - used to represent a selection-stmt
If -----------> Next
| | |
Test Then Else(op)
Test will be an Expression tree. Then and Else will be Statement trees.
Else is optional (may be NULL). Next points to the next Statement tree or is NULL.
- Return statement - used to represent a return-stmt
Return -----> Next
|
Exp
Exp is an Expression tree. Exp is optional (may be NULL). Next points to the next
Statement tree or is NULL.
- While statement - used to represent an while-stmt
While -----> Next
| |
Test Body
Test is an Expression tree. Body is a Statement tree. Next points to the next
Statement tree or is NULL.
- For statement - used to represent an for-stmt
For -------------> Next
| | | |
Init Test Iter Body
Init, Test, Iter are Expression trees (which could be NULL). Body is a Statement tree. Next points to the next
Statement tree or is NULL.
- Do statement - used to represent an do-stmt
Do -------------> Next
| |
Test Body
Test is an Expression tree (which could be NULL). Body is a Statement tree. Next points to the next
Statement tree or is NULL.
- Compound statement - used to represent a compound-stmt
Compound -----> Next
| |
LocalDecls Statement-list
LocalDecls is the first of a series of Declaration trees. It may be NULL.
Statement-list is the first of a series of Statement trees. It may be NULL.
Next points to the next Statement tree or is NULL.
- Expression statement - used to represent an expression-stmt
Expression -----> Next
|
Exp
Exp is an Expression tree. Next points to the next Statement tree or is NULL.
This structure is optional -- you could use an Expression tree directly instead.