Contents Introduction Names Variables The Concept of Binding Type Checking Strong Typing Type Equivalence Scope Scope and Lifetime Referencing Environments Named Constants Introduction


or an association between an attribute and an entity, or



Download 396.24 Kb.
Page3/16
Date18.02.2022
Size396.24 Kb.
#58269
1   2   3   4   5   6   7   8   9   ...   16
13516098

or an association between an attribute and an entity, or

between an operation and a symbol


Example:

int count;



count = count + 5;
  • - set of possible types for count: bound at language design time
  • - type of count: bound at compile time
  • - set of possible values of count: bound at language implementation time -- value of count: bound at execution time
  • - set of possible meaning for the operator +: bound at language design

  • time
  • - Meaning of the operator symbol '+': bound at compile time
  • - Internal representation of literal 5: bound at language implementation

  • time

Binding of Attributes to Variables

  • Static: A binding is static if it first occurs before run time and remains unchanged throughout program execution.
  • Dynamic: A binding is dynamic if it first occurs during execution or can change during execution of the program

Type Binding
  • How is a type specified?
  • When does the binding take place?

Before a variable can be referenced in a program it must be bound to a type. We have two key issues in binding a type to an identifier

•A variable must be bound to a data type

before it can be referenced

•When does the binding take place?

–static or dynamic binding

Static Type Binding

Dynamic Type Binding

Download 396.24 Kb.

Share with your friends:
1   2   3   4   5   6   7   8   9   ...   16




The database is protected by copyright ©ininet.org 2024
send message

    Main page