ICE1341 Programming Languages Spring 2005 Lecture #9 Lecture #9 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.

Slides:



Advertisements
Similar presentations
Chapter 6 Structured Data Types Arrays Records. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Definitions data type –collection of data objects.
Advertisements

Names, Bindings, Type Checking, and Scopes
Names, Bindings, Type Checking, and Scopes
ISBN Lecture 06 Data Types. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.6-2 Lecture 06 Topics Introduction Primitive Data.
CS 330 Programming Languages 11 / 06 / 2007 Instructor: Michael Eckmann.
ISBN Chapter 6 Data Types: Structured types.
ISBN Lecture 05 Variable Attributes.
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Definitions A data type defines a collection of data.
The Concept of Variables
Copyright © 1995 by Addison-Wesley Publishing Co. 1 Names - Design issues: - Maximum length? - Are connector characters allowed? - Are names case sensitive?
Primitive Data Types: Numbers Strings Ordinal Types Pointers
Chapter 6 Structured Data Types Arrays Records. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Definitions data type –collection of data objects.
CS 355 – Programming Languages
ICE1341 Programming Languages Spring 2005 Lecture #10 Lecture #10 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
MT311 Java Application Programming and Programming Languages Li Tak Sing ( 李德成 )
CS 330 Programming Languages 10 / 23 / 2008 Instructor: Michael Eckmann.
Software II: Principles of Programming Languages Lecture 5 – Names, Bindings, and Scopes.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
CS 330 Programming Languages 10 / 21 / 2008 Instructor: Michael Eckmann.
College of Computer Science and Engineering
ISBN 0-321— Chapter 6 Data Types. Corrected and improved by Assoc. Prof. Zeki Bayram, EMU, North Cyprus. Original Copyright © 2007 Addison-Wesley.
ISBN 0-321— Chapter 6 sections 1-4, 9 Primitive Data Types Numbers Strings Ordinal Types Pointers.
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes.
Chapter 5 © 2002 by Addison Wesley Longman, Inc Names - We discuss all user-defined names here - Design issues for names: - Maximum length? - Are.
COMP4730/2003/lec5/H.Melikian Names, Bindings,Type Checking and Scopes (Chapter 5) - Design issues: - Maximum length? - Are connector characters allowed?
1 CS Programming Languages Class 07 September 14, 2000.
Names, Bindings, Type Checking, and Scopes
5-1 Chapter 5: Names, Bindings, Type Checking, and Scopes Variables The Concept of Binding Type Checking Strong Typing Type Compatibility Scope and Lifetime.
March 12, ICE 1341 – Programming Languages (Lecture #6) In-Young Ko Programming Languages (ICE 1341) Lecture #6 Programming Languages (ICE 1341)
Chapter 5 Names, Bindings, and Scopes. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 5 Topics Introduction Names Variables The Concept.
ISBN Chapter 5 Names, Bindings, and Scopes.
Introduction A variable can be characterized by a collection of properties, or attributes, the most important of which is type, a fundamental concept in.
1 Type Checking Type checking ensures that the operands and the operator are of compatible types Generalized to include subprograms and assignments Compatible.
ISBN Chapter 5 Names, Bindings, and Scopes.
ISBN Chapter 6 Data Types Introduction Primitive Data Types User-Defined Ordinal Types.
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 6 Topics Introduction Primitive Data Types Character.
CS 330 Programming Languages 10 / 30 / 2007 Instructor: Michael Eckmann.
Structure of Programming Language Data Types. 2 A data type defines a collection of data objects and a set of predefined operations on those objects An.
C H A P T E R S I X Data Types.
CS 330 Programming Languages 10 / 31 / 2006 Boo! Instructor: Michael Eckmann.
Names, Bindings, and Scope Session 3 Course : T Programming Language Concept Year : February 2011.
Structure of Programming Languages Names, Bindings, Type Checking, and Scopes.
1 CS Programming Languages Class 08 September 19, 2000.
ISBN Chapter 6 Structured Data Types Array Types Associative Arrays Record Types Union Types.
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved. 6-2 Chapter 6 Topics Introduction Primitive Data Types.
1 Data Types Primitive Data Types Character String Types User-Defined Ordinal Types Array Types Associative Arrays Record Types Union Types Pointer Types.
Data Types W E E K F O U R. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 6 Topics Introduction Primitive Data Types Character String.
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes.
ISBN Variables, Names, Scope and Lifetime ICOM 4036 Lecture 9.
CS 330 Programming Languages 11 / 01 / 2007 Instructor: Michael Eckmann.
1 Structure of Compilers Lexical Analyzer (scanner) Modified Source Program Parser Tokens Semantic Analysis Syntactic Structure Optimizer Code Generator.
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved.2 Primitive Data Types Almost all programming languages.
Names, Bindings, Type Checking and Scopes. Chapter 5 Topics Introduction Names Variables The Concept of Binding Type Checking Strong Typing Type Equivalence.
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes.
Structure of Programming Language Data Types. 2 A data type defines a collection of data objects and a set of predefined operations on those objects An.
Data Types Chapter 6: Data Types Lectures # 11. Topics Introduction Primitive Data Types Character String Types Array Types Associative Arrays Record.
5.2 Names - We discuss all user-defined names here
5.2 Names - We discuss all user-defined names here
Data Types In Text: Chapter 6.
Chapter 6 – Data Types CSCE 343.
Chapter 6 Data Types.
Type Checking Generalizes the concept of operands and operators to include subprograms and assignments Type checking is the activity of ensuring that the.
Type Checking, and Scopes
Chapter 6: Data Types Lectures # 10.
Structure of Programming Language
Chapter 6 Data Types.
Names, Bindings, Type Checking, and Scopes
Chapter 6 Data Types.
Presentation transcript:

ICE1341 Programming Languages Spring 2005 Lecture #9 Lecture #9 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University (ICU)

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Binding Lifetimes (cont.) Binding Lifetimes (cont.) WWW Concepts WWW Concepts WWW Languages WWW Languages XML (Extended Markup Language) XML (Extended Markup Language) Last Lecture

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University This Lecture Scope Rules Scope Rules Data Types Data Types Primitive Types Primitive Types Character String Data Types Character String Data Types User-defined Data Types User-defined Data Types Arrays Arrays

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University An XML-based Programming Language <program> 0 0 n 1 n 1 n n <assignment> val val n n n 1 n 1 </assignment> </function> result 5 result 5 </program>

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University An Example class MyClass { int myVar1 = 100, myVar2 = 200; void myMethod1() { System.out.println(myVar1); System.out.println(myVar1); { int myVar1 = 200; { int myVar1 = 200; System.out.println(myVar1); System.out.println(myVar1); System.out.println(this.myVar1); System.out.println(this.myVar1); } System.out.println(myVar1); System.out.println(myVar1);} class InnerClass { int myVar1 = 300; int myVar1 = 300; void myMethod2() { void myMethod2() { System.out.println(myVar1); System.out.println(myVar1); System.out.println(myVar2); System.out.println(MyClass.this.myVar1); }}} How many different variables are defined in the program? How many different variables are defined in the program? In which program units the variables are visible? In which program units the variables are visible? What are the current values of the variables? What are the current values of the variables?

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Scope Scope of a Variable: the range of statements over which it is visible Scope of a Variable: the range of statements over which it is visible Visibility: a variable is visible in a statement if it can be referenced in that statement Visibility: a variable is visible in a statement if it can be referenced in that statement Scope Rules of a Language: determine how references to names are associated with variables Scope Rules of a Language: determine how references to names are associated with variables Non-local Variables: variables that are visible but not declared in a program unit (block) Non-local Variables: variables that are visible but not declared in a program unit (block) Static Scope: the scope of a variable that can be determined prior to execution Static Scope: the scope of a variable that can be determined prior to execution

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University An Example of Nested Static Scopes class MyClass { int myVar1 = 100, myVar2 = 200; void myMethod1() { System.out.println(myVar1); System.out.println(myVar1); { int myVar1 = 200; { int myVar1 = 200; System.out.println(myVar1); System.out.println(myVar1); System.out.println(this.myVar1); System.out.println(this.myVar1); } System.out.println(myVar1); System.out.println(myVar1);} class InnerClass { int myVar1 = 300; int myVar1 = 300; void myMethod2() { void myMethod2() { System.out.println(myVar1); System.out.println(myVar1); System.out.println(myVar2); System.out.println(MyClass.this.myVar1); }}} The scope of myVar1 and myVar2 The scope of the local variable, myVar1 A block for defining the local variable, myVar1 myVar2 is a non-local variable in this block InnerClass is the static parent of myVar2InnerClass is the static parent of myVar2 MyClass is the static ancestor of myVar2MyClass is the static ancestor of myVar2 Accessing the hidden variable, myVar1

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Program Blocks A method of creating static scopes inside program units A method of creating static scopes inside program units Introduced in ALGOL 60 Introduced in ALGOL 60 Block-structured Languages Block-structured Languages Examples: Examples: C and C++: for (...) { C and C++: for (...) { int index; int index; } Ada: declare LCL : FLOAT; Ada: declare LCL : FLOAT; begin begin end end * AW Lecture Notes

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Problems in Static Scoping (1) Required procedure access: MAIN calls A and B MAIN calls A and B A calls C and D A calls C and D B calls A and E B calls A and E Program Structure Desirable Calls Potential Calls

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Problems in Static Scoping (2) Suppose the spec is changed so that D must now access some data in B Suppose the spec is changed so that D must now access some data in B Solutions: Solutions: Put D in B (but then C can no longer call it and D cannot access A's variables) Put D in B (but then C can no longer call it and D cannot access A's variables) Move the data from B that D needs to MAIN (but then all procedures can access them) Move the data from B that D needs to MAIN (but then all procedures can access them) Same problem for procedure access Same problem for procedure access Overall: static scoping often encourages many globals Overall: static scoping often encourages many globals * AW Lecture Notes

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Dynamic Scope The scope of a variable is determined based on calling sequences of program units, not their textual layout (temporal versus spatial) The scope of a variable is determined based on calling sequences of program units, not their textual layout (temporal versus spatial) * AW Lecture Notes Advantage: convenience Advantage: convenience Disadvantage: poor readability Disadvantage: poor readability Reference to x is to SUB1's x MAIN - declaration of x SUB1 SUB1 - declaration of x - - declaration of x call SUB2 call SUB SUB2 SUB reference to x - - reference to x call SUB1 call SUB1 … MAIN calls SUB1 SUB1 calls SUB2 SUB2 uses x e.g.,

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Other Scoping Issues Scope and Lifetime Scope and Lifetime In Java, the scope of a variable is spatial (textual), and the lifetime of the variable is temporal In Java, the scope of a variable is spatial (textual), and the lifetime of the variable is temporal In Java, a static variable in a method is statically bound to its scope, and is also statically bound to storage In Java, a static variable in a method is statically bound to its scope, and is also statically bound to storage Reference Environments Reference Environments The referencing environment of a statement is the collection of all names that are visible in the statement The referencing environment of a statement is the collection of all names that are visible in the statement In a static-scoped language, it is the local variables plus all of the visible variables in all of the enclosing scopes In a static-scoped language, it is the local variables plus all of the visible variables in all of the enclosing scopes In a dynamic-scoped language, the referencing environment is the local variables plus all visible variables in all active subprograms In a dynamic-scoped language, the referencing environment is the local variables plus all visible variables in all active subprograms * AW Lecture Notes

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Other Scoping Issues Named constant: a variable that is bound to a value only when it is bound to storage Named constant: a variable that is bound to a value only when it is bound to storage Advantages: readability and modifiability Advantages: readability and modifiability Used to parameterize programs Used to parameterize programs The binding of values to named constants can be either static (called manifest constants) or dynamic The binding of values to named constants can be either static (called manifest constants) or dynamic Pascal: literals only Pascal: literals only FORTRAN 90: constant-valued expressions FORTRAN 90: constant-valued expressions Ada, C++, and Java: expressions of any kind Ada, C++, and Java: expressions of any kind Variable Initialization: the binding of a variable to a value at the time it is bound to storage Variable Initialization: the binding of a variable to a value at the time it is bound to storage If the storage binding of a variable is dynamic, initialization is also dynamic If the storage binding of a variable is dynamic, initialization is also dynamic * AW Lecture Notes

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Chapter 6

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Data Types A data type defines a collection of data objects and a set of predefined operations on those objects A data type defines a collection of data objects and a set of predefined operations on those objects Primitive Data Types: data types that are not defined in terms of other types (e.g., int, float, char) Primitive Data Types: data types that are not defined in terms of other types (e.g., int, float, char) Structured Data Types: non-scalar data types that specify structured organizations of data of other types (e.g., arrays, records) Structured Data Types: non-scalar data types that specify structured organizations of data of other types (e.g., arrays, records) Design issues for all data types: Design issues for all data types: What is the syntax of references to variables? What is the syntax of references to variables? What operations are defined and how are they specified? What operations are defined and how are they specified?

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Primitive Data Types – Numeric Types (1) Integer Integer Its representation usually reflects the hardware (size, notation – ones or twos complement) Its representation usually reflects the hardware (size, notation – ones or twos complement)twos complementtwos complement e.g., Java – byte, short, int, long; C – unsigned int e.g., Java – byte, short, int, long; C – unsigned intJava CJava C Floating-point Floating-point Model real numbers, but only as approximations Model real numbers, but only as approximations IEEE Floating-Point Standard 754 format IEEE Floating-Point Standard 754 format IEEE Floating-Point Standard 754 IEEE Floating-Point Standard 754 e.g., Java – float, double e.g., Java – float, double Precision: the accuracy of the fractional part of a value Precision: the accuracy of the fractional part of a value Range: a combination of the ranges of fractions and exponents Range: a combination of the ranges of fractions and exponents

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Primitive Data Types – Numeric Types (2) Decimal Decimal Store a fixed number of decimal digits (coded), with decimal point at a fixed position Store a fixed number of decimal digits (coded), with decimal point at a fixed position BCD (Binary Coded Decimal) BCD (Binary Coded Decimal) BCD (Binary Coded Decimal) BCD (Binary Coded Decimal) Advantage: accuracy (e.g., 0.1 represented in BCD vs. Floating-point) Advantage: accuracy (e.g., 0.1 represented in BCD vs. Floating-point) Disadvantages: limited range, wastes memory Disadvantages: limited range, wastes memory Boolean Boolean Could be implemented as bits, but often as bytes Could be implemented as bits, but often as bytes Advantage: readability Advantage: readability Character Character Stored as numeric codings (e.g., ASCII, Unicode) Stored as numeric codings (e.g., ASCII, Unicode)ASCIIUnicodeASCIIUnicode * AW Lecture Notes

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Character String Types Character String: a sequence of characters Character String: a sequence of characters Design issues: Design issues: Is it a primitive type or just a special kind of array? Is it a primitive type or just a special kind of array? e.g., Java – the String class, C – character arrays (char *str) Is the length of strings static or dynamic? Is the length of strings static or dynamic? Static length strings – e.g., Java, Fortran Static length strings – e.g., Java, Fortran Limited dynamic length strings – e.g., C (sizeof vs. strlen) Limited dynamic length strings – e.g., C (sizeof vs. strlen) Dynamic length strings – e.g., JavaScript, Perl Dynamic length strings – e.g., JavaScript, Perl Operations: Operations: Assignment, Comparison (e.g., strcmp, >), Catenation (e.g., strcat, +), Substring reference, Pattern matching (e.g., indexOf, matches) Assignment, Comparison (e.g., strcmp, >), Catenation (e.g., strcat, +), Substring reference, Pattern matching (e.g., indexOf, matches)matches * AW Lecture Notes

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Implementation of String Types Static length - compile-time descriptor Static length - compile-time descriptor Limited dynamic length - may need a run-time descriptor for length (C and C++ use ‘\0’ to indicate the end of the string) Limited dynamic length - may need a run-time descriptor for length (C and C++ use ‘\0’ to indicate the end of the string) Dynamic length - need run-time descriptor; allocation/deallocation is the biggest implementation problem Dynamic length - need run-time descriptor; allocation/deallocation is the biggest implementation problem * AW Lecture Notes Compile-time descriptor for static strings Run-time descriptor for limited dynamic strings

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University User-Defined Ordinal Types An ordinal type is one in which the range of possible values can be easily associated with the set of positive integers An ordinal type is one in which the range of possible values can be easily associated with the set of positive integers e.g., Java – int, char, boolean Enumeration Types: user-defined ordinal types in which named constants (enumeration constants) are provided in the definition Enumeration Types: user-defined ordinal types in which named constants (enumeration constants) are provided in the definition e.g., enum days { Mon, Tue, Wed, Thu, Fri, Sat, Sun }; days myDay = Sat; days myDay = Sat; char *str = names[Tue]; char *str = names[Tue]; C++, C#, Pascal, Ada support enumeration types C++, C#, Pascal, Ada support enumeration types Improve readability and reliability (restricting ranges) Improve readability and reliability (restricting ranges)

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Design Issues of User-Defined Ordinal Types Reuse of constants (overloaded literals) Reuse of constants (overloaded literals) e.g., enum weekendDays { Sat, Sun }; ? e.g., enum weekendDays { Sat, Sun }; ? The type of an occurrence of a constant needs to be determined based on its context The type of an occurrence of a constant needs to be determined based on its context Ada supports overloaded literals Ada supports overloaded literals Coercion to integer Coercion to integer e.g., myDay++; ? e.g., myDay++; ? myDay = 4; ? myDate = (days)4; ? myDay = 4; ? myDate = (days)4; ? C++ enumeration types are coerced to integer C++ enumeration types are coerced to integer

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Subrange Types (Subtypes) Contiguous sequences of an ordinal type Contiguous sequences of an ordinal type e.g., subtype Index is Integer range ; type Days is ( Mon, Tue, Wed, Thu, Fri, Sat, Sun); type Days is ( Mon, Tue, Wed, Thu, Fri, Sat, Sun); subtype Weekdays is Days range Mon..Fri; subtype Weekdays is Days range Mon..Fri; Pascal and Ada support subrange types Pascal and Ada support subrange types Subtypes are not new types, just constrained existing types (so they are compatible); c.f., Derived Types Subtypes are not new types, just constrained existing types (so they are compatible); c.f., Derived Types e.g., type Derived_Int is new Integer range ; subtype Subrange_Int is Integer range ; subtype Subrange_Int is Integer range ; Enhance readability and reliability Enhance readability and reliability

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Array Types Array: an aggregate of homogeneous data elements in which an individual element is identified by its position (subscript or index) Array: an aggregate of homogeneous data elements in which an individual element is identified by its position (subscript or index) Indexing: a mapping from indices to elements Indexing: a mapping from indices to elements e.g., A(2), A[2], *(A + 2) e.g., A(2), A[2], *(A + 2) Subscript Types: Subscript Types: FORTRAN, C, Java – integer only FORTRAN, C, Java – integer only Pascal, Ada – any ordinal type (integer, boolean, char, enum) Pascal, Ada – any ordinal type (integer, boolean, char, enum) … 01n-1n An element Subscripts (Indices) A:

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Categories of Arrays Based on subscript binding and binding to storage Stack Area (Local variables) Static Area (Program code & non-local, static variables) Heap Area (Dynamically allocated/deallocated blocks) A program space in the memory …… A Static (Fortran 77) … 01n-1n A Stack-dynamic … 01n-1n A Fixed heap-dynamic (Fortran 90, Java) … A Fixed stack-dynamic (Ada) … 01n-1x A Heap-dynamic (Perl, JavaScript)

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Other Design Issues of Arrays Number of subscripts (Dimension) Number of subscripts (Dimension) FORTRAN I allowed up to three FORTRAN I allowed up to three FORTRAN 77 allows up to seven FORTRAN 77 allows up to seven Others - no limit Others - no limit Array Initialization Array Initialization A list of values – e.g. (C), int stuff [] = {2, 4, 6, 8}; A list of values – e.g. (C), int stuff [] = {2, 4, 6, 8}; Positioned values – e.g. (Ada), Positioned values – e.g. (Ada), SCORE : array (1..14, 1..2) := (1 => (24, 10), 2 => (10, 7), 3 =>(12, 30), others => (0, 0)); Array Operations Array Operations Assignment, Concatenation, Elemental ops. (+), etc. Assignment, Concatenation, Elemental ops. (+), etc. Intrinsic (library) operations (e.g., matrix ops) Intrinsic (library) operations (e.g., matrix ops) APL supports many array operations APL supports many array operations

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Multi-dimensional Arrays Rectangular Array Jagged Array Slices: Substructures of an array e.g., FORTRAN 90 INTEGER MAT (1:4, 1:4) MAT(1:4, 1) - the first column MAT(2, 1:4) - the second row

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Implementation of Array Types Access Function: maps subscript expressions to an address in the array Access Function: maps subscript expressions to an address in the array addr(A[k]) = addr(A[lbound]) + ((k - lbound) * ele_size); Row major order vs. column major order Row major order vs. column major order Compile-time descriptors: Compile-time descriptors: Single- dimensioned array Multi- dimensional array

Spring ICE 1341 – Programming Languages © In-Young Ko, Information and Communications University Homework #4 Write a simple Java program that includes: Write a simple Java program that includes: At least two non-local variables defined with initialization At least two non-local variables defined with initialization At least two static variables defined in different scopes At least two static variables defined in different scopes At least two overwriting variables defined in different scopes At least two overwriting variables defined in different scopes At least two accesses of hidden variables At least two accesses of hidden variables Two named constants, one with the static value binding, and the other with the dynamic value binding Two named constants, one with the static value binding, and the other with the dynamic value binding Add comments to indicate where those variables are Add comments to indicate where those variables are Explain the static scopes of the variables Explain the static scopes of the variables Explain the lifetimes of the variables Explain the lifetimes of the variables Explain the reference environments at three different locations in the program Explain the reference environments at three different locations in the program Due by March 31st