What is binding and binding time in compiler design?


The binding of a program element to a specific characteristic or property is the choice of the property from a set of possible properties. The time during program organization or processing when this choice is made is defined as the binding time of that property for that element. There are multiple varieties of bindings in programming languages, and a variety of binding times. It can also involve within the terms of binding and binding time the properties of program elements that are constant either by the definition of the language or its execution.

Types of Binding Times

There are two types of binding times which are as follows −

  • Execution Time (Run-Time) − Some bindings are implemented during program execution. These contain bindings of variables to their values, and the binding of variables to specific storage areas. The property of runtime bindings are as follows −

    • On entry to a subprogram or block − In some languages, bindings are limited to appear only at the time of entry to a subprogram or block during execution.

    • At arbitrary points during execution − Some bindings can appear at any point during the execution of a program. An example is the basic binding of variables to values through assignment, whereas some languages such as LISP, Smalltalk, and ML allow the binding of names to storage locations to also appear at arbitrary points in the program.

  • Translation time (compile-time) − There are three different types of translation time bindings are as follows −

    • Bindings have been chosen by the programmer − In writing a program, the programmer consciously produces some decisions concerning choices of variable names, types for variables, program statement structures, etc. that describe bindings during translation. The language translator creates the use of these bindings to decide the final structure of the object code.

    • Bindings chosen by the translator − Some bindings are selected by the language translator without a direct programmer requirement. For example, the relative area of a data object in the storage designated for a phase is usually managed without knowledge or intervention by the programmer.

    • Bindings chosen by the loader − A program generally includes multiple subprograms that should be combined into a single executable program. The translator generally binds variables to addresses within the storage name for each subprogram. This storage should be assigned actual addresses within the physical computer that will implement the program.

Updated on: 22-Oct-2021

8K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements