{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Feb27 - 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 Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right 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 27, 2007 Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/27/07 Outline ¡ Recap ¡ Data types (Chapter 6) ¡ Expressions and assignment statements (Chapter 7) ¡ Summary and homework Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/27/07 Data Types ¡ Primitive data types ¡ Character string types ¡ User-defined ordinal types ¡ Array types ¡ Pointer types ¡ Record types ¡ Union types Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/27/07 Data Types ¡ Primitive data types ¡ Character string types ¡ User-defined ordinal types ¡ Array types ¡ Pointer types ¡ Record types ¡ Union types Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/27/07 Records ¡ An aggregate of possibly heterogeneous data elements ¡ Individual elements are identified by names ¡ Record fields ¡ Record definition syntax ¡ C: struct ¡ typedef struct bTreeNode { struct bTreeNode * child[2]; int nodeValue; } node; node* bTreeRoot; ¡ Java/C++ ¡ Data classes with data members as record fields Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/27/07 More Record Definitions ¡ COBOL uses level numbers to define nested records 01 EMPLOYEE-RECORD. 02 EMPLOYEE-NAME. 03 FIRST PICTURE IS X(20). 03 MIDDLE PICTURE IS X(10). 03 LAST PICTURE IS X(20). 02 HOURLY-RATE PICTURE IS 99V99. ¡ Others use recursive definition (Ada, Fortran) type Employee_Name_Type is record First : String (1..20); Middle : String (1..10); Last : String (1..20); end record ; type Employee_Record_Type is record Employee_Name : Employee_Name_Type; Hourly_Rate : Float; end record ; Employee_Record : Employee_Record_type; Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/27/07 Reference to Record Fields ¡ Dot notation used by Ada, C/C++, etc record_name_1.record_name_2. ... record_name_n.field_name nodeA.nodeValue Employee_Record.Employee_Name.Middle ¡ Fortran: replace . with % ¡ COBOL field_name OF record_name_n OF ... OF record_name_1 ¡ Fully qualified references must include all record names ¡ MIDDLE OF EMPLOYEE-NAME OF EMPLOYEE-RECORD ¡ Elliptical references allow leaving out record names as long as the reference is unambiguous (COBOL) ¡ FIRST, FIRST OF EMPLOYEE-NAME, FIRST OF EMPLOYEE- RECORD Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/27/07 Implementation A compile-time descriptor for a record Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/27/07 Outline ¡ Recap ¡ Expressions and assignment statements (Chapter 7) ¡ Summary and homework Instructor: Dr. Liang Cheng CSE262: Programming Languages 02/27/07 Introduction ¡ Expressions ¡ Fundamental means of specifying computations ¡ Syntax is described by BNF...
View Full Document

{[ snackBarMessage ]}

Page1 / 34

Feb27 - 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 bookmark
Ask a homework question - tutors are online