Book contents
- Frontmatter
- Contents
- List of Boxes
- Preface
- Part I Introduction
- Part II Action Notation
- Part III Semantic Descriptions
- Chapter 11 Statements
- Chapter 12 Literals
- Chapter 13 Expressions
- Chapter 14 Declarations
- Chapter 15 Variables
- Chapter 16 Subprograms
- Chapter 17 Tasks
- Part IV Conclusion
- Appendices
- Bibliography
- Symbol Index
- Concept Index
Chapter 14 - Declarations
Published online by Cambridge University Press: 19 January 2010
- Frontmatter
- Contents
- List of Boxes
- Preface
- Part I Introduction
- Part II Action Notation
- Part III Semantic Descriptions
- Chapter 11 Statements
- Chapter 12 Literals
- Chapter 13 Expressions
- Chapter 14 Declarations
- Chapter 15 Variables
- Chapter 16 Subprograms
- Chapter 17 Tasks
- Part IV Conclusion
- Appendices
- Bibliography
- Symbol Index
- Concept Index
Summary
Declarations include definitions of constants and packages. Expressions include identifiers, as well as aggregates for arrays and records and selection of components. Statements include blocks with local declarations.
The semantic description of declarations, etc., illustrates the use of the declarative action notation introduced in Chapter 7.
Semantic entities now include general array and record values, and packages.
Declarations in programs are constructs that are similar to mathematical definitions, in that they introduce symbols and determine their interpretation. The symbols introduced are called identifiers. Declarations are said to bind identifiers to their interpretation.
The scope of a declaration is the part of the program in which its binding is valid. This is usually the rest of the block statement in which it occurs, except for inner blocks where the same identifier is re-declared, thus making a hole in the scope of the outer-level declaration. Declarations can also occur in modules, which are called packages in ADA. A module may limit the scope of the declarations in it, and it declares a module identifier which may be used to import the bindings of the declarations into other modules.
The processing of a declaration is called its elaboration. Declarations may involve expressions that are to be evaluated, so their elaboration generally has a computational aspect—in contrast to mathematical definitions.
A record value is similar to a module or package entity, in that its field identifiers can be regarded as bound to component values.
- Type
- Chapter
- Information
- Action Semantics , pp. 152 - 162Publisher: Cambridge University PressPrint publication year: 1992