Block
. Blocks can be nested
. The property is referred to as block structured
. Scope of the declaration is given by most closely nested rule
- The scope of a declaration in block B includes B
- If a name X is not declared in B
then an occurrence of X is in the scope of declarator X in B ' such that
. B ' has a declaration of X
. B ' is most closely nested around B
Blocks contains its own local data structure. Blocks can be nested and their starting and ends are marked by a delimiter. They ensure that either block is independent of other or nested in another block. That is, it is not possible for two blocks B1 and B2 to overlap in such a way that first block B1 begins, then B2, but B1 end before B2. This nesting property is called block structure.
The scope of declaration in a block-structured language is given by the most closely nested rule:
1. The scope of a declaration in a block B includes B.
2. If a name X is not declared in a block B, then an occurrence of X in B is in the scope of a declaration of X in an enclosing block B ' such that
. B ' has a declaration of X, and
. B ' is more closely nested around B then any other block with a declaration of X.
|