Organization of Programming Languages (CSE452)

Slides:



Advertisements
Similar presentations
Adapted from Scott, Chapter 6:: Control Flow Programming Language Pragmatics Michael L. Scott.
Advertisements

Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter One Preliminaries, including –Why study PL concepts? –Programming domains –PL evaluation criteria.
Chapter 1: Preliminaries
PLLab, NTHU Cs2403 Programming Languages Implementation Issues Cs2403 Programming Language Spring 2005 Kun-Yuan Hsieh.
Reasons to study concepts of PL
ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
CS 354 Overview. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Course Topics What is a programming language? What features do programming.
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Programming Language Concepts
1 Programming Languages Marjan Sirjani 2 1- The Study of Programming Languages The purpose of language is simply that it must convey meaning. (Confucius)
CS 415: Programming Languages Chapter 1 Aaron Bloomfield Fall 2005.
Copyright © 2005 Elsevier Chapter 1 :: Introduction Programming Language Pragmatics Michael L. Scott.
Language Evaluation Criteria
CSE 425: Intro to Programming Languages and their Design A Few Key Ideas No particular language is a prerequisite for this course –However you should be.
MT311 Java Programming and Programming Languages Li Tak Sing ( 李德成 )
CS 326 Programming Languages, Concepts and Implementation
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
CS 363 Comparative Programming Languages
Gary MarsdenSlide 1University of Cape Town Principles of programming language design Gary Marsden Semester 2 – 2001.
CS 330 Programming Languages 09 / 04 / 2008 Instructor: Michael Eckmann.
1 CSC 533: Organization of Programming Languages Spring 2010 See online syllabus at: Course goals:  understand issues in designing,
1 Programming Languages Marjan Sirjani Course web site:
1 Introduction Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Sections
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
ICS 313 Fundamentals of Programming Languages Instructor: Abdul Wahid Wali Lecturer, CSSE, UoH
ISBN CS 354 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Course Topics What is a programming language? What features.
Engr. Isabelo Jun D. Paat, ME-CoE Lecturer 1 Programming Languages.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
1 Organization of Programming Languages-Cheng (Fall 2005) Organization of Programming Languages (CSE452) Instructor: Dr. B. Cheng Fall 2005.
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
Programming Language Theory 2014, 1 Chapter 1 :: Introduction Origin : Michael L. Scott School of Computer & Information Engineering,
CSC 533: Programming Languages Spring 2016
CSC 533: Programming Languages Spring 2015
Concepts of Programming Languages
Chapter 1 Preliminaries.
Introduction to programming languages, Algorithms & flowcharts
Concepts of Programming Languages
Why study programming languages?
Chapter 1 Preliminaries.
Introduction to programming languages, Algorithms & flowcharts
PROGRAMMING LANGUAGES
CS 3304 Comparative Languages
CS 3304 Comparative Languages
1.1 Reasons to study concepts of PLs
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Introduction to programming languages, Algorithms & flowcharts
Chap. 6 :: Control Flow Michael L. Scott.
Chapter 1 Introduction.
Chapter 1 Preliminary. Chapter 1 Preliminary 1.1 Reasons for Studying Concepts of Programming Languages Increased capacity to express ideas Improved.
Chapter 1 Preliminaries.
Chap. 6 :: Control Flow Michael L. Scott.
High Level Programming Languages
Chapter 1 Preliminaries.
Low Level Programming Languages
Principles of Programming Languages
Chapter 1 Preliminaries.
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
School of Computer & Information Engineering,
Chapter 1 Preliminaries.
Programming Languages, Preliminaries, History & Evolution
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Presentation transcript:

Organization of Programming Languages (CSE452) Instructor: Dr. B. Cheng Fall 2005

Why are there so many programming languages? Evolution -- we've learned better ways of doing things over time Socio-economic factors: Proprietary interests, Commercial advantage orientation toward special purposes Orientation toward special hardware Diverse ideas about what is pleasant to use

What makes a language successful? Ease of use: Easy to learn (BASIC, Pascal, LOGO, Scheme) Easy to express things Easy to use once fluent -- "powerful" (C++, Common Lisp, APL, Algol-68, perl) Easy to implement (BASIC, Forth) possible to compile to very good (fast/small) code (ForTran) Cost factors: Backing of a powerful sponsor (COBOL, PL/1, Ada, Visual Basic) Wide dissemination at minimal cost (Pascal, Turing, Java)

Why do we have programming languages? Programmer’s perspective: way of thinking way of expressing algorithms languages from the user's point of view Abstraction of virtual machine way of specifying what you want the hardware to do without getting down into the bits languages from the implementor's point of view Course Objective: balance coverage of two angles. Commonalities and differences among languages Implementations of languages

History of Programming Languages http://www.webopedia.com/TERM/P/programming_language.html

Major Influences to Programming Languages Computer Architecture Von Neumann Architecture Programming methodologies Programming paradigms

Von Neumann Architecture

Influence of Computer Architecture Programming Language Memory cells Pipelined execution of instructions  Variables Computation is viewed as a sequence of actions 

Programming Paradigms Imperative Procedural (von Neumann) ForTran, C, Basic, Pascal, Algol60 Object-Oriented Simula67, C++, Smalltalk, Java, C# Declarative Functional LISP, Scheme, ML, Haskell Logical Prolog, VisiCalc, RPG, spreadsheets

Desirable Qualities of Software Software must be reliable Program performs to its specification under all conditions Software must be maintainable It is no longer feasible to always build software from scratch Must be able to easily modify existing software Software must execute efficiently Although hardware getting cheaper and has better performance, need for efficient execution remains due to increasingly demanding applications

Why study programming languages? Help you choose a language. C v Modula-3 v C++ for systems programming Fortran v APL v Ada for numerical computations C v Ada vs Modula-2 for embedded systems Common Lisp v Scheme v ML for symbolic data manipulation Java v. C/CORBA for networked PC programs

Why study programming languages? Make it easier to learn new languages (by analogy) some languages are similar; easy to walk down family tree (e.g., ForTran 77, ForTran90) Identify common concepts : E.g.: iteration, recursion, abstraction Think of an analogy to human languages: good grasp of grammar makes it easier to pick up new languages (at least romance languages).

Make better use of language Understand obscure features: In C, help you understand unions, arrays & pointers, separate compilation, varargs, In Common Lisp, help you understand first-class functions/closures, streams, catch and throw, symbol internals

Make better use of language Understand implementation costs: choose between alternative ways of doing things, based on knowledge of what will be done underneath: Use simple arithmetic equalities (use x*x instead of x**2) Use C pointers or Pascal "with" statement to factor address calculations avoid call by value with large data items in Pascal avoid the use of call by name in Algol 60 choose between computation and table lookup

Make better use of given language Figure out how to do things in languages that don't support them explicitly: Lack of suitable control structures in Fortran IV use comments and programmer discipline for control structures Lack of recursion in Fortran 77, CSP, etc. write a recursive algorithm then use mechanical recursion elimination (even for things that aren't quite tail recursive) lack of named constants and enumerations in Fortran use variables that are initialized once, then never changed lack of modules in C and Pascal use comments and programmer discipline lack of iterators in just about everything fake them with (member?) functions

Language Design Criteria Simplicity Simpler language is easier to master Achieved by having a small number of features Feature multiplicity: more than one way to accomplish the same task E.g.: count++; count = count + 1; count += 1 Operator overloading: same operator has more than one meaning Overload “+” operator for Summing integers in two arrays Concatenating two arrays

Language Design Criteria Orthogonality Every possible combination of primitive constructs of the language is legal and meaningful Lack of orthogonality means lots of exceptions in the language rules Assembly language for IBM mainframe: A Reg1, memory cell Two different rules for addition AR Reg1, Reg2 Cannot use A for adding 2 registers Too much orthogonality makes language become overly complex (Algol 68)

Language Design Criteria-Syntax Identifier forms Fortran77 restricts identifiers to ≤6 characters Special words Pascal requires begin-end pairs to form groups for all control constructs Ada uses “end if” or “end loop” to distinguish closing syntax for each type of control statement Fortran 90 allows special words such as DO and END to be legal variable names

Language Design Criteria Safety Language should not provide features that make it possible to write harmful programs E.g., goto statements and pointer variables Type checking testing for type errors in a given program, during compilation or program execution Aliasing Having two or more distinct referencing methods, or names, for the same memory cell (e.g., union members, pointers in C) Robustness Provides the ability to deal with undesired events (arithmetic overflows, invalid input, etc) E.g., Exception handling facility in Java and C++

Language Design Criteria Portability: Programs can be compiled and run on different machines without rewriting the source code Uniformity: Similar notations should look and behave in the same way (e.g., every “end” must be preceded by a matching “begin”) Support for abstraction Ability to define and then use complicated structures or operations in ways that allow many details to be ignored Process abstraction vs Data abstraction

Design Trade-offs Reliability vs Efficiency Ada demands all references to array to be checked to ensure that indices are within their legal ranges C does not require index range checking, and thus executes faster Buffer overflow problem void function (char *str) { char buffer[16]; strcpy (buffer, str); } int main () { char *str = "I am greater than 16 bytes"; function (str); }

Design Trade-offs Flexibility vs Safety Pascal variant records allow a memory cell to contain either a pointer or an integer This allows a program to do arithmetic on pointers, which is sometimes convenient, but is a dangerous practice.

Course Organization Lectures material supplement textbook material (i.e., come to class) Homework assignments reinforce key concepts Programming assignments give hands-on experience Exams provide a way for you to demonstrate what you’ve learned (and I need something to use for calculating grades)

Course Organization Homework 15% Programming Assignments 30% Exams (2) 50% In-class participation 5%