Complex Data Types One very important measure of the “goodness” of a PL is the capability of its data types to model the problem space variables Design.

Slides:



Advertisements
Similar presentations
Elementary Data Types Prof. Alamdeep Singh. Scalar Data Types Scalar data types represent a single object, i.e. only one value can be derived. In general,
Advertisements

Chapter 6 Structured Data Types Arrays Records. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Definitions data type –collection of data objects.
ISBN Lecture 06 Data Types. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.6-2 Lecture 06 Topics Introduction Primitive Data.
ISBN Chapter 6 Data Types: Structured types.
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Definitions A data type defines a collection of data.
The environment of the computation Declarations introduce names that denote entities. At execution-time, entities are bound to values or to locations:
Elementary Data Types Scalar Data Types Numerical Data Types Other
ISBN 0-321— Chapter 6 Data Types. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 6 Topics Introduction Primitive Data Types Character.
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.
Data Types. Primitives Integer Float Character Boolean Pointers Aggregates Strings Records Enumerated Arrays Objects.
CS 355 – Programming Languages
MT311 Java Application Programming and Programming Languages Li Tak Sing ( 李德成 )
ISBN 0-321— Chapter 6 Data Types. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 6 Topics Introduction Primitive Data Types Character.
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.
1 Data Types In Text: Chapter 5. 2 Chapter 5: Data Types Outline What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers.
Basic Semantics Associating meaning with language entities.
COMP4730/2002/lec6/H.Melikian Data Types Primitive Data Types User_Defined Ordinal Types Array Types Record types Union Types Set Types Pointer Types.
1 Records Record aggregate of data elements –Possibly heterogeneous –Elements/slots are identified by names –Elements in same fixed order in all records.
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 6 Topics Introduction Primitive Data Types Character.
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 6 Topics Introduction Primitive Data Types Character.
ISBN Chapter 6 Data Types. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.6-2 Chapter 6 Topics Introduction Primitive Data.
ISBN 0-321— Chapter 6 Data Types. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 6 Topics Introduction Primitive Data Types Character.
C H A P T E R S I X Data Types.
CS 363 Comparative Programming Languages Data Types.
ISBN Chapter 6 Data Types Pointer Types Reference Types Memory Management.
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.
Chapter 6 © 2002 by Addison Wesley Longman, Inc Introduction - Evolution of Data Types: FORTRAN I (1957) - INTEGER, REAL, arrays … Ada (1983) -
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 6 Topics Introduction Primitive Data Types Character.
ISBN Chapter 6 Data Types. Copyright © 2006 Addison-Wesley. All rights reserved.2 Primitive Data Types Almost all programming languages.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter 5 Evolution of Data Types: FORTRAN I (1956) - INTEGER, REAL, arrays … Ada (1983) - User can.
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.
CSI 3125, Data Types, page 1 Data types Outline Primitive data types Structured data types Strings Enumerated types Arrays Records Pointers Reading assignment.
Data Types Chapter 6: Data Types Lectures # 13. Topics Chapter 6: Data Types 2 Introduction Primitive Data Types Character String Types Array Types Associative.
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
6.1 Introduction 6.2 Primitive Data Types - Evolution of Data Types:
Data Types In Text: Chapter 6.
Dr. Vamsi Paruchuri University of Central Arkansas
Data Types I Subject : T0152 – Programming Language Concept
Chapter 6 Data Types.
Chapter 6 – Data Types CSCE 343.
CMP 339/692 Programming Languages Day 14 Tuesday, March 20, 2012
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.
6.1 Introduction 6.2 Primitive Data Types - Evolution of Data Types:
Chapter 6: Data Types Lectures # 10.
Structure of Programming Language
CS 326 Programming Languages, Concepts and Implementation
Instructor : Ahmed Alalawi Slides from Chung –Ta King
Records Design Issues: 1. What is the form of references?
Chapter 6 Data Types.
Data Types In Text: Chapter 6.
PZ06C - Polymorphism Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section 7.3 PZ06C.
Chapter 6 Data Types.
Chapter 6 Data Types.
Chapter 6 Data Types.
Chapter 6 Data Types.
Types and Related Issues
Run-time environments
Lecture 7: Types (Revised based on the Tucker’s slides) 10/4/2019
SPL – PS2 C++ Memory Handling.
Presentation transcript:

Complex Data Types One very important measure of the “goodness” of a PL is the capability of its data types to model the problem space variables Design issues for all data types what is the syntax of references to variables? what operations are defined and how are they specified? Compilers use descriptors to maintain information about instances of types in a program actually part of the symbol table what’s needed in descriptor depends on particular type when the descriptor is needed depends on the kind of type checking required static, compile time only dynamic, run-time as well

Primitive types Numeric Boolean Character strings Ordinal

Numeric Types Range and Precision Integer Real Decimal

Boolean

Character string

Character String Issues Primitive or not Snobol, Java primitive Ada, F77, F90, Basic “somewhat” primitive Pascal, C, C++ not primitive Static or dynamic Or limited length dynamic Operations

Strings (continued) Evaluation Implementation aid to writability as a primitive type with static length, they are inexpensive to provide--why not have them? dynamic length is nice, but is it worth the expense? Implementation static length - compile-time descriptor limited dynamic length - may need a run-time descriptor for length (but not in C and C++) dynamic length - need run-time descriptor; allocation/deallocation is the biggest problem

Ordinal Enumeration Subrange

Arrays

Arrays Definition Mapping Memory allocation Slices Associative arrays Row major or column major Memory allocation Static Fixed stack dynamic Stack dynamic Heap dynamic Slices Associative arrays Operations

Records

Records Definition Mapping Operations Faster than array subscripts Elliptical references (COBOL, PL/I) Operations Move corresponding

Unions

Unions Definition Type checking? Useful but dangerous Not in Java Ada yes, others no Useful but dangerous

Sets Pascal, Java

Pointers

Pointers Operations Dynamic storage management or indirect addressing? Assignment and dereferencing Dynamic storage management or indirect addressing? Scope/lifetime of pointers and associated dynamic objects? Problems Dangling references, lost objects Storage management Reference counts, garbage collection Java allows only references Implicit deallocation