Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.

Slides:



Advertisements
Similar presentations
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Advertisements

Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter One Preliminaries, including –Why study PL concepts? –Programming domains –PL evaluation criteria.
Chapter 1: Preliminaries
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 5 Types Types are the leaven of computer programming;
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is.
Overview of Programming Paradigms
High-Level Programming Languages
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.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 14 Functional Programming It is better to.
Programming Languages Structure
Chapter 8 High-Level Programming Languages Nell Dale John Lewis.
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Introduction and Syntax. Course objectives Discuss features of programming languages. Discuss how the features are implemented in a simple computer architecture.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
CS 331, Principles of Programming Languages Introduction.
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.
Overview. Copyright © 2006 The McGraw-Hill Companies, Inc. Chapter 1 Overview A good programming language is a conceptual universe for thinking about.
PZ01A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ01A -- Introduction Programming Language Design and.
CS 355 – Programming Languages
There are only 10 types of people in the world, those who understand binary and those who don't.
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Chapter 1. Introduction.
BIT 1003 – Presentation 7. Contents GENERATIONS OF LANGUAGES COMPILERS AND INTERPRETERS VIRTUAL MACHINES OBJECT-ORIENTED PROGRAMMING SCRIPTING LANGUAGES.
CS 363 Comparative Programming Languages
CST2231_introduction1 Programming Languages A programming language is a language that is intended to be used by a person to express a process by which.
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
Chapter 1 - Introduction
1 Programming Language History and Evolution In Text: Chapter 2.
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.
Computer Concepts 2014 Chapter 12 Computer Programming.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
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
Programming Languages Design Considerations (Qualities) Readability –Simplicity and Clarity –Orthogonality –Control Statements –Data Types and Structures.
Programming Languages Meeting 14 December 9/10, 2014.
ISBN CS 354 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Course Topics What is a programming language? What features.
ISBN Chapter 1 Preliminaries. Copyright © 2009 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
CS 345: Programming Language Paradigms Chris Brooks HR 510 MWF 11:00-12:05.
Programming Language Concepts (CIS 635) Elsa L Gunter 4303 GITC NJIT,
CS 331, Principles of Programming Languages Chapter 1.
Chapter 8 High-Level Programming Languages. 2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
Analysis of Programming Languages (2). 2 LANGUAGE DESIGN CONSTRAINTS  Computer architecture  Technical setting  Standards  Legacy systems.
Programming Languages
1-1 1 Introduction  Programming linguistics: concepts and paradigms syntax, semantics, and pragmatics language processors.  Historical development of.
CPS120 Introduction to Computer Science High Level Language: Paradigms.
Programming Language History and Evolution
Chapter 1. Introduction.
Programming Languages 2nd edition Tucker and Noonan
CSC 533: Programming Languages Spring 2016
CSC 533: Programming Languages Spring 2015
Concepts of Programming Languages
Basic 1960s It was designed to emphasize ease of use. Became widespread on microcomputers It is relatively simple. Will make it easier for people with.
Why study programming languages?
PROGRAMMING LANGUAGES
CSCI-235 Micro-Computer Applications
Programming Language History and Evolution
High Level Programming Languages
Programming Languages
Programming Languages 2nd edition Tucker and Noonan
Principles of Programming Languages
Overview of Programming Paradigms
강의 내용 및 방법 접근방법 리포트 시험 Lambda Calculus, Proof of Correctness
Presentation transcript:

Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 1 Overview A good programming language is a conceptual universe for thinking about programming. A. Perlis

Copyright © 2006 The McGraw-Hill Companies, Inc. A programming paradigm is a pattern of problem- solving thought that underlies a particular genre of programs and languages. There are four main programming paradigms: –Imperative –Object-oriented –Functional –Logic (declarative) Paradigms of Programming Languages

Copyright © 2006 The McGraw-Hill Companies, Inc. Imperative Paradigm Follows the classic von Neumann-Eckert model: –Program and data are indistinguishable in memory –Program = a sequence of commands –State = values of all variables when program runs –Large programs use procedural abstraction Example imperative languages: –Cobol, Fortran, C, Ada, Perl, …

Copyright © 2006 The McGraw-Hill Companies, Inc. The von Neumann-Eckert Model

Copyright © 2006 The McGraw-Hill Companies, Inc. Object-oriented (OO) Paradigm An OO Program is a collection of objects that interact by passing messages that transform the state. When studying OO, we learn about: –Sending Messages –Inheritance –Polymorphism Example OO languages: Smalltalk, Java, C++, C#, and Python

Copyright © 2006 The McGraw-Hill Companies, Inc. Functional Paradigm Functional programming models a computation as a collection of mathematical functions. –Input = domain –Output = range Functional languages are characterized by: –Functional composition –Recursion Example functional languages: –Lisp, Scheme, ML, Haskell, …

Copyright © 2006 The McGraw-Hill Companies, Inc. Compute Factorial Function –In Imperative Programming Languages: –In Functional Programming Languages: Scheme Functional vs Imperative fact(int n) { if (n <= 1) return 1; else return n * fact(n-1); } (define (fact n) (if (< n 1) 1 (* n (fact (- n 1))) ))

Copyright © 2006 The McGraw-Hill Companies, Inc. Logic Paradigm Logic programming declares what outcome the program should accomplish, rather than how it should be accomplished. When studying logic programming we see: –Programs as sets of constraints on a problem –Programs that achieve all possible solutions –Programs that are nondeterministic Example logic programming languages: –Prolog

Copyright © 2006 The McGraw-Hill Companies, Inc. Logic vs Imperative Concatenate two strings: –In Imperative Programming Languages: –In Logic Programming Languages: Prolog append([], X, X). append(Tail, Y, Z) append([Head|Tail], Y, [Head|Z]) :- The empty list concatenated with any other list, say X, returns that other list, X, as the result If Z is the result of concatenating lists Tail and Y, then Concatenating any new list [Head|Tail] with Y gives the result [Head | Z]

Copyright © 2006 The McGraw-Hill Companies, Inc. Example append([english, russian], [spanish], L) H= english, Tail = [russian], Y=[spanish], L=[english|Z] append([russian],[spanish],[Z]) H=russian, Tail=[], Y=[spanish], [Z]=[russian|Z’] append([],[spanish],[Z’]). X =[spanish], Z’ = [spanish] append([], [spanish], [spanish])

Copyright © 2006 The McGraw-Hill Companies, Inc. A Brief History of Programming Languages

Copyright © 2006 The McGraw-Hill Companies, Inc. What makes a successful language? Key characteristics: –Simplicity and readability –Clarity about binding –Reliability –Support –Abstraction –Orthogonality –Efficient implementation

Copyright © 2006 The McGraw-Hill Companies, Inc. Simplicity and Readability Small instruction set –Is a smaller number of instructions better? Simple syntax –More than one way to accomplish a particular op, –A single op has more than one meaning Benefits: –Ease of learning –Ease of programming

Copyright © 2006 The McGraw-Hill Companies, Inc. Reliability A language is reliable if: –Program behavior is the same on different platforms E.g., early versions of Fortran –Type errors are detected E.g., C vs Haskell –Semantic errors are properly trapped E.g., C vs C++ –Memory leaks are prevented E.g., C vs Java

Copyright © 2006 The McGraw-Hill Companies, Inc. Language Support Accessible (public domain) compilers/interpreters Good texts and tutorials Wide community of users Integrated with development environments (IDEs)

Copyright © 2006 The McGraw-Hill Companies, Inc. Abstraction in Programming Data –Programmer-defined types/classes –Class libraries Procedural –Programmer-defined functions –Standard function libraries

Copyright © 2006 The McGraw-Hill Companies, Inc. Orthogonality A language is orthogonal if its features are built upon a small, mutually independent set of primitive operations. Fewer exceptional rules = conceptual simplicity –E.g., restricting types of arguments to a function Tradeoffs with efficiency

Copyright © 2006 The McGraw-Hill Companies, Inc. Compiler – produces machine code Interpreter – executes instructions on a virtual machine Example compiled languages: –Fortran, Cobol, C, C++ Example interpreted languages: –Scheme, Haskell, Python Hybrid compilation/interpretation –The Java Virtual Machine (JVM) Compilers and Virtual Machines

Copyright © 2006 The McGraw-Hill Companies, Inc. The Compiling Process

Copyright © 2006 The McGraw-Hill Companies, Inc. The Interpreting Process