Feb13 - CSE262: Programming Languages Instructor: Dr. Liang...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSE262: Programming Languages Instructor: Dr. Liang Cheng Department of Computer Science and Engineering P.C. Rossin College of Engineering & Applied Science Lehigh University February 13, 2007 Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/13/07 Outline Recap Scope (Sections 5.8-5.10) Data types (Chapter 6) Summary and homework Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/13/07 You should now be able to Describe static scope and dynamic scope; Find references to variables in static- scoped or dynamic-scoped languages; and Decide referencing environments. Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/13/07 Scope of a Variable The range of statements where a variable is visible or can be referenced Static scoping / lexical scoping Algol 60, C, Pascal, C++, Java, Scheme, Dynamic scoping LISP, Common LISP and Perl support both Scope Static scope Dynamic scope Scope and lifetime Referencing env variable: name, address, value, type, lifetime, scope Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/13/07 Referencing Environments 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 dynamic-scoped language, the referencing environment is the local variables plus all visible variables in all active subprograms Scope Static scope Dynamic scope Scope and lifetime Referencing env variable: name, address, value, type, lifetime, scope Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/13/07 Outline Recap Data types (Chapter 6) Summary and homework Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/13/07 Data Types A data type defines a collection of data objects and a set of predefined operations on those objects Primitive data types Character string types User-defined ordinal types Array types Record types Union types Pointer types Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/13/07 Integer There may be as many as eight different integer types in a language Ones-complement notation Twos-complement notation Primitive data types Integer Floating point Decimal Boolean Character Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/13/07 Floating Point Languages for scientific use support at least two floating-point types IEEE Std 754: 00111110001000000000000000000000 v = (sign bit) 2 Exponent-127 (1.Fraction) 2 Fraction: precision; exponent & fraction: range Primitive data types Integer Floating point Decimal Boolean Character Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/13/07 Decimal For business applications COBOL, C# Store a fixed number of decimal digits (binary coded decimal) 1 digit/byte (BCD) or 2 digits/byte (packed BCD) 27 => 00000010 00000111 or 0010 0111...
View Full Document

Page1 / 50

Feb13 - CSE262: Programming Languages Instructor: Dr. Liang...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online