Ch. 5 Ch. 51 jcmt Summer 2003Programming Languages CSE3302 Programming Languages (more notes) Summer 2003 Dr. Carter Tiernan.

Slides:



Advertisements
Similar presentations
C Language.
Advertisements

Intermediate Code Generation
Programming Languages and Paradigms
Programming Languages and Paradigms The C Programming Language.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
1 Compiler Construction Intermediate Code Generation.
CS 415: Programming Languages Algol Aaron Bloomfield Fall 2005.
CS ExCo Advanced in Topics Object-Oriented Programming.
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
Chapter 6 Structured Data Types Arrays Records. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Definitions data type –collection of data objects.
ALGOL 60 Design by committee of computer scientists: Naur, Backus, Bauer, McCarthy, van Wijngaarden, Landin, etc. Design by committee of computer scientists:
ISBN Chapter 6 Data Types: Structured types.
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes Names Variables The Concept of Binding Type Checking Strong Typing Type Compatibility.
G. Levine Chapter 6 Chapter 6 Encapsulation –Why do we want encapsulation? Programmer friendliness- programmer need not know about these details –Easier.
Copyright © 1995 by Addison-Wesley Publishing Co. 1 Names - Design issues: - Maximum length? - Are connector characters allowed? - Are names case sensitive?
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
The environment of the computation Declarations introduce names that denote entities. At execution-time, entities are bound to values or to locations:
Chapter 9: Subprogram Control
Pascal By: Liane Tom. Outline o Background o Data types and Syntax o Procedures and Functions o Advantages o Disadvantages.
Chapter 6 Structured Data Types Arrays Records. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Definitions data type –collection of data objects.
CSCE 330 Project Algol 68 Joe PuzioWael AL-Fayez Gaurav ShahRonak Patel.
Chapter 6Java: an Introduction to Computer Science & Programming - Walter Savitch 1 l Array Basics l Arrays in Classes and Methods l Programming with Arrays.
Block-Structured Procedural Languages Lecture 11: Dolores Zage.
PASCAL. HISTORY OF PASCAL Developed by Niklaus Wirth a member of the International Federation of Information Processing(IFIP) To provide features that.
Imperative Programming
Semantic Analysis Legality checks –Check that program obey all rules of the language that are not described by a context-free grammar Disambiguation –Name.
Pascal Course Spring Introduction Designed: 1968/9 by Niklaus Wirth Published: 1970 Imperative, structural, procedural Static and strong.
Gary MarsdenSlide 1University of Cape Town Principles of programming language design Gary Marsden Semester 2 – 2001.
Names Variables Type Checking Strong Typing Type Compatibility 1.
5-1 Chapter 5: Names, Bindings, Type Checking, and Scopes Variables The Concept of Binding Type Checking Strong Typing Type Compatibility Scope and Lifetime.
Dr. Muhammed Al-MulhemICS Chapter 5 The Algol Family and Haskell.
March 12, ICE 1341 – Programming Languages (Lecture #6) In-Young Ko Programming Languages (ICE 1341) Lecture #6 Programming Languages (ICE 1341)
1 CMPE 104 Pascal (Modified slides of Tom Rethard)
Introduction A variable can be characterized by a collection of properties, or attributes, the most important of which is type, a fundamental concept in.
CSC3315 (Spring 2008)1 CSC 3315 Subprograms Hamid Harroud School of Science and Engineering, Akhawayn University
1 Records Record aggregate of data elements –Possibly heterogeneous –Elements/slots are identified by names –Elements in same fixed order in all records.
Programming Languages and Paradigms Imperative Programming.
Ch. 5 Ch. 51 jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (more notes) Dr. Carter Tiernan.
Types(1). Lecture 52 Type(1)  A type is a collection of values and operations on those values. Integer type  values..., -2, -1, 0, 1, 2,...  operations.
Ch Ch jcmt CSE 3302 Programming Languages CSE3302 Programming Languages (notes, notes, notes) Dr. Carter Tiernan.
ISBN Chapter 6 Structured Data Types Array Types Associative Arrays Record Types Union Types.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Variables reference, coding, visibility. Rules for making names  permitted character set  maximum length, significant length  case sensitivity  special.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
1 Structure of Compilers Lexical Analyzer (scanner) Modified Source Program Parser Tokens Semantic Analysis Syntactic Structure Optimizer Code Generator.
Ch Ch jcmt CSE 3302 Programming Languages CSE3302 Programming Languages Dr. Carter Tiernan.
ISBN Chapter 5 Names, Bindings, Type Checking, and Scopes.
Ada, Scheme, R Emory Wingard. Ada History Department of Defense in search of high level language around Requirements drafted for the language.
Procedure Definitions and Semantics Procedures support control abstraction in programming languages. In most programming languages, a procedure is defined.
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Operational Semantics (Slides mainly.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
1 jcmt Summer 2003Programming Languages CSE3302 Programming Languages Summer 2003 Dr. Carter Tiernan.
Dr. M. Al-Mulhem Introduction 1 Chapter 6 Type Systems.
CSC 533: Programming Languages Spring 2016
Lecture 9 Symbol Table and Attributed Grammars
CSE3302 Programming Languages (notes continued)
Data Types In Text: Chapter 6.
Names and Attributes Names are a key programming language feature
CSC 533: Programming Languages Spring 2015
Def: A control structure is a control statement and
Type Checking Generalizes the concept of operands and operators to include subprograms and assignments Type checking is the activity of ensuring that the.
Introduction to Scheme
CS 326 Programming Languages, Concepts and Implementation
Records Design Issues: 1. What is the form of references?
Chapter 8: Control Structures
FORTRAN 04 February 1999; CS655.
Chapter 6 Intermediate-Code Generation
Symbol Table 薛智文 (textbook ch#2.7 and 6.5) 薛智文 96 Spring.
Types and Related Issues
Lecture 7: Types (Revised based on the Tucker’s slides) 10/4/2019
Presentation transcript:

Ch. 5 Ch. 51 jcmt Summer 2003Programming Languages CSE3302 Programming Languages (more notes) Summer 2003 Dr. Carter Tiernan

Ch. 5 Ch. 52 jcmt Summer 2003Programming Languages Return to Simplicity Attempts to extend Algol included: –PL/I very large intersection of FORTRAN, COBOL, and Algol “Swiss army knife” approach –Extensible languages Kernal: application independent Ex: operator extensions & syntax macros Inefficient; hard to debug

Ch. 5 Ch. 53 jcmt Summer 2003Programming Languages Pascal Niklaus Wirth designed successor languages to Algol Goal was to compete with FORTRAN and keep the benefits of Algol Explicit goals –Suitable for teaching programming –Reliable, efficient implementation

Ch. 5 Ch. 54 jcmt Summer 2003Programming Languages Pascal Structure Syntax is Algol-like Uses reserved words New structures added –Name –Data –Control

Ch. 5 Ch. 55 jcmt Summer 2003Programming Languages Data Structures Primitives –Real, integer, boolean from Algol –Characters : type char Enumeration types –Replaces integer codes to represent lists –Limits range of values explicitly –Keeps types unique and separate –Defined as a binding construct –Only allows meaningful operations –Efficient implementation

Ch. 5 Ch. 56 jcmt Summer 2003Programming Languages Data Structures Subrange types –Security and efficiency Set types –Mathematical application –Efficient –Set operations defined - implemented with bit operations

Ch. 5 Ch. 57 jcmt Summer 2003Programming Languages Arrays Generalized index types (integer subranges) Allowable element types - any other Pascal base type including other arrays, etc. No multi dimensional arrays BUT can have an array whose element type is array and “syntactic sugar” allows appearance of multi- dim arrays Restrictions on Pascal arrays –Static bounds : determinable at compile time –Dimensions are part of array type –Feature interaction problem with bounds

Ch. 5 Ch. 58 jcmt Summer 2003Programming Languages Records Aggregate heterogeneous data –Components can be primitive types or complex data types including records and arrays –Component selection within a record is done with dot notation – with statement opens a record for accessing multiple fields within the block of the with

Ch. 5 Ch. 59 jcmt Summer 2003Programming Languages Arrays vs. Records Structure Element typesSelectors Array HomogeneousDynamic (computable) Record HeterogeneousStatic

Ch. 5 Ch. 510 jcmt Summer 2003Programming Languages Variant Records Groups different fields according to a status value The status value is called the tag field Creates a loophole related to type because variant fields do not have to be initialized and previous values of different type may be accessible

Ch. 5 Ch. 511 jcmt Summer 2003Programming Languages Data types (cont.) Pascal structures allow efficient information storage Pascal has pointers –Pointers have data types to support strong typing in Pascal –Pointer base types can be any other type Initially type equivalence was not clearly defined –Structural, Name (simpler and safer) –Subrange equivalence within Name eq

Ch. 5 Ch. 512 jcmt Summer 2003Programming Languages Name Structures Bindings –Constant –Type –Variable –Procedure and function –Implicit enumeration –Label

Ch. 5 Ch. 513 jcmt Summer 2003Programming Languages Name Structures Constants abstract out dependencies Constants cannot be described by an expression Expressions cannot be used in variable or type declarations

Ch. 5 Ch. 514 jcmt Summer 2003Programming Languages Name Struct Constructors Records Procedures –Much like Algol in format and scope –Order of declarations was important for one-pass compilation Reverses top-down order No way to define mutually recursive procs – forward declaration (like C prototype decl) Group order important also

Ch. 5 Ch. 515 jcmt Summer 2003Programming Languages Control Structures More structures than Algol but simpler I/O routines provided Structured control is supported –One entry, one exit Supports recursion Has a goto to facilitate adoption

Ch. 5 Ch. 516 jcmt Summer 2003Programming Languages Structures for –Austere & even simpler than FORTRAN DO while / do –Condition at beginning repeat / until –Condition at end case –Labeled cases

Ch. 5 Ch. 517 jcmt Summer 2003Programming Languages Parameters Pass by reference Pass by value Pass by constant –Input parameter treated as a constant inside called routine –Compiler can either copy or pass address of parameter –Left loophole similar to aliasing problem

Ch. 5 Ch. 518 jcmt Summer 2003Programming Languages Procedural parameters Can pass procedures and functions as parameters Originally, formal specification gave procedure name and return type but not parameters of procedure being passed Standard required parameters to be specified also

Ch. 5 Ch. 519 jcmt Summer 2003Programming Languages Pascal Excellent teaching language Suitable for “real” programming Other Languages PL/I extensions BCPL - Cambridge Plus London B - BCPL based & used in 1st Unix (8k PDP-7) C - successor of ‘B’ by Dennis Ritchie –Used to rewrite Unix kernel –Characteristics of 1st, 2nd, and 3rd gen languages

Ch. 5 Ch. 520 jcmt Summer 2003Programming Languages Third Gen. Languages Simplicity and efficiency Data structures support applications –Support nesting –User definition –Pointers Name structures have bindings for new types Control structures are simplified and efficient –Case