Flashcards
Programming Languages - Chapter 5
Cards in this deck (29)
- 1VariableAn abstraction of a memory cell
- 2Variables can be characterized by a collection of attributes:name, address, value, type, lifetime, scope
- 3NameA name is a string of characters used to identify some entity in a program
- 4Design issues for names:Maximum length?
Are names case sensitive?
Are special words reserved words or keywords allowed? - 5KeywordA word that is special only in certain contexts
- 6Reserved WordA special word that cannot be used as a user-defined name
- 7AddressThe memory address with which a variable is associated (also called l-value)
- 8TypeDetermines the range of values the variable can store and the set of operations that are defined for values of that type
- 9ValueThe contents of the memory cell or cells with which the variable is associated.
The r-value of a variable is its value - 10BindingAn association, such as between an attribute and an entity, or between an operation and a symbol
- 11Binding TimesThe time at which a binding takes place:
Language design time
Compile time
Load time
Run time - 12Static BindingA binding is static if it first occurs before run time (during compile time) and remains unchanged throughout program execution
- 13Dynamic BindingA binding is dynamic if it first occurs during execution or can change during execution of the program
- 14Type BindingBefore a variable can be referenced in a program, it must be bound to a data type
- 15Explicit DeclarationA program statement used for declaring the types of variables
- 16Implicit DeclarationA default mechanism for specifying types of variables
- 17LifetimeLifetime of a variable is the time during which the variable is bound to a specific memory cell
- 18Variables can be classified into 4 categories, according to their lifetimes:static
stack-dynamic
explicit heap-dynamic
implicit heap-dynamic - 19StaticBound to memory cells before execution begins and remains bound to the same memory cell throughout execution
- 20Static advantages/disadvantagesAdvantages: efficiency (direct addressing), history-sensitive subprogram support
Disadvantage: lack of flexibility (no recursion) - 21Stack-DynamicStorage bindings are created for variables when their declaration statements are elaborated (A declaration is elaborated when the executable code associated with it is executed)
- 22Stack-Dynamic advantages/disadvantagesAdvantage: allows recursion; conserves storage
Disadvantages: Overhead of allocation and deallocation Subprograms cannot be history sensitive. Inefficient references (indirect addressing) - 23Explicit Heap-DynamicAllocated and deallocated by explicit directives, specified by the programmer, which take effect during execution
- 24Explicit Heap-Dynamic advantages/disadvantagesAdvantage: provides for dynamic storage management
Disadvantage: inefficient and unreliable - 25Implicit Heap-DynamicVariables are bound to storage only when they are assigned values
- 26Implicit Heap-Dynamic advantages/disadvantagesAdvantage: flexibility
Disadvantages: Inefficient, because all attributes are dynamic. Loss of error detection - 27ScopeThe range of statements over which a variable is visible
- 28Nonlocal VariablesVariables of a program unit that are visible but not declared there
- 29Referencing EnvironmentThe referencing environment of a statement is the collection of all names that are visible in the statement
Information
- Description
- Flashcards on Programming Languages - Chapter 5, created by M KB on 20/02/2018.
- Created by
- M KB
- Views
- 2
- Rating