Types and Related Issues

Slides:



Advertisements
Similar presentations
Names, Bindings, Type Checking, and Scopes
Advertisements

Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter 4 Names - Design issues: - Maximum length? - Are connector characters allowed? - Are names case.
Names and Bindings.
Chapter 5 Names, Bindings, and Scopes
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
Variables Names Bindings Type Scope. L-Value versus R-Value Not complicated Associated with assignment statements Left hand side represents an address.
Names, Bindings, Type Checking, and Scopes
CS 330 Programming Languages 10 / 16 / 2008 Instructor: Michael Eckmann.
Names, Bindings, Type Checking, and Scopes
1 Names, Scopes and Bindings. 2 Names Kinds of names Kinds of names Variables, functions, classes, types, labels, blocks, operators, tasks, etc. Variables,
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes Names Variables The Concept of Binding Type Checking Strong Typing Type Compatibility.
ISBN Lecture 05 Variable Attributes.
Copyright © 1995 by Addison-Wesley Publishing Co. 1 Names - Design issues: - Maximum length? - Are connector characters allowed? - Are names case sensitive?
Names and Bindings Introduction Names Variables The concept of binding Chapter 5-a.
CMSC331. Some material © 1998 by Addison Wesley Longman, Inc. 1 Chapter 5 Chapter 5 Variables: Names, Bindings, Type Checking and Scope.
MT311 Java Application Programming and Programming Languages Li Tak Sing ( 李德成 )
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
Names and Binding In procedural programming, you write instructions the manipulate the “state” of the process where the “state” is the collection of variables.
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 Variables Type Checking Strong Typing Type Compatibility 1.
Names, Bindings, Type Checking, and Scopes
COME Chapter 5 Chapter 5 Variables: Names, Bindings, Type Checking and Scope.
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)
Introduction A variable can be characterized by a collection of properties, or attributes, the most important of which is type, a fundamental concept in.
Basic Semantics Associating meaning with language entities.
1 Type Checking Type checking ensures that the operands and the operator are of compatible types Generalized to include subprograms and assignments Compatible.
CS 363 Comparative Programming Languages Names, Type Checking, and Scopes.
Names, Bindings, and Scope Session 3 Course : T Programming Language Concept Year : February 2011.
Structure of Programming Languages Names, Bindings, Type Checking, and Scopes.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Concepts of programming languages Chapter 5 Names, Bindings, and Scopes Lec. 12 Lecturer: Dr. Emad Nabil 1-1.
Variables reference, coding, visibility. Rules for making names  permitted character set  maximum length, significant length  case sensitivity  special.
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes.
Names and Binding In Text: Chapter 4.
ISBN Variables, Names, Scope and Lifetime ICOM 4036 Lecture 9.
1 Structure of Compilers Lexical Analyzer (scanner) Modified Source Program Parser Tokens Semantic Analysis Syntactic Structure Optimizer Code Generator.
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes.
Names, Scope, and Bindings Programming Languages and Paradigms.
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.
Chapter 5 Names, Bindings, Type Checking CSCE 343.
5.2 Names - We discuss all user-defined names here
5.2 Names - We discuss all user-defined names here
Names, Bindings, Type Checking, and Scopes
Advanced Programming in C
Data Types In Text: Chapter 6.
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
Structure of Programming Languages
Chapter 5 Names, Bindings, Type Checking, and Scopes.
Names, Bindings, and Scopes
Chapter 5 Names, Bindings, Type Checking, and Scopes.
Names and Binding Imperative programming has instructions that manipulate the “state” of the process the “state” is the collection of variables and their.
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.
Names, Bindings, Type Checking, and Scopes
CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics
Names, Bindings, Type Checking, and Scopes
Names and Binding In Text: Chapter 5.
Names, Bindings, and Scopes
Lecture 6: Names (Revised based on the Tucker’s slides) 5/27/2019
CSC 533: Organization of Programming Languages Spring 2007
Names, Bindings, Type Checking, and scopes
Presentation transcript:

Types and Related Issues Bindings

Bindings Are factors that characterize objects name location value type scope lifetime

Bindings (continued) Can be static or dynamic Can occur at many different times: language design operator symbols to operations language implementation range of values for integers compile variable to type link call to library subprogram load static variables to memory cells run value to variable

Names

Names Format Aliasing length character set case reserved word or keyword for meaningful names in the language? Aliasing

Location

Location Static Stack dynamic Explicit heap dynamic Implicit heap dynamic rare, used in APL and Algol-68

Type

Type Primitive or complex Usually bound statically Coercion or casting but can be dynamic in LISP, APL, SNOBOL Coercion or casting Strong typing language “always detects type errors” Name compatibility or structure compatibility name: same declaration or same type name easier to implement but restrictive structure: same internal structure may not be strict enough

Type (continued) Most languages use a combination of equivalence methods Pascal: usually structure, but in some cases name is used (formal parameters) C: structure, except for records C++: name Ada: restricted form of name derived types allow types with the same structure to be different type celcius is new real; type fahrenheit is new real; subtype allows types to be compatible even with different names subtype digit is INTEGER range 0..9;

Scope

Scope Range of statements in a program when a name can be referenced (is visible) Controlled by subprograms, compound statements Static most languages Dynamic APL, SNOBOL, some LISPs means no compile-time type checking of non-local objects

Lifetime

Period when data object is allocated memory Can be different than scope hole in scope static variables invoking external subprogram