point when a program element is bound to a characteristic or property Categories of Binding Times Execution Time during program execution binding of variables to values binding of variables to their locations eg automatics in C ID: 528277
Download Presentation The PPT/PDF document "Binding" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
Binding
point when a program element is bound to a characteristic or property Slide2
Categories of Binding Times
Execution Time
– during program execution
binding of variables to values
binding of variables to their locations (e.g., automatics in C)
binding of parameters to arguments
on function entry for
by value
and
by address
parameters
on reference for
by name
parameters
Translation Time
(compile time) - bindings performed by the compiler
binding of variables to their data types (C)
binding of variables to their structure (C)
binding of variables to their locations (static in C, but the actual address is bound by the loader)Slide3
Categories of Binding Times
Language Definition Time -
when the language was described
meaning of +, -, *, /
meaning of if, printf
Language Implementation Time -
variations for a particular implementation of the
language
ordering of bits (little endian, big endian)
size of int, size of long
meaning of isalpha in CSlide4
Importance of Binding Times
Changing of binding times can modify the definition of a language
Suppose we bind all variables to their locations at compile/load time, how would that impact a language?
No by address parameter passing
No dynamic arrays (where the size is defined at runtime)
No
recursionSlide5
Importance of Binding Times
Later binding times can decrease the speed of code execution
If data types are bound at
runtime:
Less error detection available during translation
Arithmetic
operations would require checking the datatypes of operands, slowing
executionSlide6
Importance of Binding Times
Later binding times can increase the flexibility of a language
Binding
the size of an array at runtime:
We can allocate the size we actually need instead of an arbitrary
large amount
Allocating memory at runtime:
We can allow a data structure (e.g., linked list) to grow
We can share heap memory with multiple data structures
Statements translated at runtime:
We could more easily modify code during execution
Data could act as program statementsSlide7
What happens when?
In C, “what happens when” for the following statement:
iX = iY + 5;
Execution:
Value of iX and iY
Translation:
data types for iX and iY
data type of + result and = result
Language Def:
data type of 5
m
eaning
of +
meaning
of
=
Language Imp:
representation of 5
representation of result of iY + 5
Unknown (due to example):
Location of iX and iY