ISBN 0-321-19362-8 Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.

Slides:



Advertisements
Similar presentations
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter One Preliminaries, including –Why study PL concepts? –Programming domains –PL evaluation criteria.
Advertisements

Chapter 1: Preliminaries
CS 354 Overview. Addison-Wesley –2 Course Topics What is a programming language? What features do programming languages have? How are these features.
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.
ISBN Chapter 1 Preliminaries. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
CS 354 Overview. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Course Topics What is a programming language? What features do programming.
ISBN Chapter 1 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
Programming Languages Structure
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 INTRODUCTION "When the only tool you have is a hammer, everything looks like a nail" (Abraham.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Concepts of Programming Languages Chapter 1.
ISBN Chapter 1 Preliminaries. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
Programming Language Concepts
Chapter 1 Preliminaries.
Chapter 1 Preliminaries. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of Programming Languages.
C H A P T E R O N E Overview.
ISBN Chapter 1 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved. 1-2 Chapter 1 Topics Reasons for Studying Concepts of.
CS 355 – Programming Languages
CS 363 Comparative Programming Languages
Chapter 1 Preliminaries CS Concepts of Programming Languages.
Programming Languages Summer
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 Chapter 1 Preliminaries. Corrected and improved by Assoc. Prof. Zeki Bayram, EMU, North Cyprus. Original Copyright © 2007 Addison-Wesley.
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 © 2015 Pearson. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of Programming.
ISBN Chapter 1 Preliminaries. Copyright © 2009 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
ISBN Chapter 1 Preliminaries. 1-2 Chapter 1 Preliminaries 1.1 Reasons for Studying Concepts of Programming Languages 1.2 Programming Domains.
ISBN Structure of Programming Languages Prof. Dr. Mostafa Abdel Aziem Mostafa Senior Lecturer
Chapter 1 Preliminaries. Copyright © 2017 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of Programming Languages.
ISBN Chapter 1 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
Chapter 1 Preliminaries.
CSCI 3370: Principles of Programming Languages Introduction
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
PROGRAMMING LANGUAGES
Chapter 1 Reasons to study concepts of PLs Programming Domains
1.1 Reasons to study concepts of PLs
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
CS 3304 Comparative Languages Fall 2011
Chapter 1 Introduction.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminary. Chapter 1 Preliminary 1.1 Reasons for Studying Concepts of Programming Languages Increased capacity to express ideas Improved.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
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.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Reasons To Study Programming Languages
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Presentation transcript:

ISBN Lecture 01 Preliminaries

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language Design Trade-Offs Implementation Methods Programming Environments

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-3 Motivation: Why Study Programming Languages? Increased ability to express ideas Improved background for choosing appropriate languages Greater ability to learn new languages Understand significance of implementation Ability to design new languages Overall advancement of computing

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-4 Programming Domains Scientific applications –Large number of floating point computations Business applications –Produce reports, use decimal numbers and characters Artificial intelligence –Symbols rather than numbers manipulated Systems programming –Need efficiency because of continuous use Scripting languages –Put a list of commands in a file to be executed Special-purpose languages –Simulation

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-5 Language Evaluation Criteria Readability –The most important criterium –Factors: Overall simplicity –Too many features is bad –Multiplicity of features is bad Orthogonality –A relatively small set of primitive constructs can be combined in a relatively small number of ways –Every possible combination is legal –Meaning is context independent –Lack of orthogonality leads to exceptions to rules –Makes the language easy to learn and read

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-6 Language Evaluation Criteria –Readability factors (continued) Control statements –goto Defining data types and structures –True vs 1, record vs array Syntax considerations –Identifier forms –Special words –Form and meaning »Meaning should directly follows syntax »static

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-7 Language Evaluation Criteria Writability –Factors: Simplicity and orthogonality Support for abstraction –Program and data abstraction Expressivity Reliability –Factors: Type checking Exception handling Aliasing Readability and writability

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-8 Language Evaluation Criteria Cost –Training programmers to use language –Writing programs –Compiling programs –Executing programs –Language implementation system –Reliability –Maintaining programs Others: portability, generality, well- definedness

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-9 Influences on Language Design Computer architecture: Von Neumann We use imperative languages, at least in part, because we use von Neumann machines –Data and programs stored in same memory –Memory is separate from CPU –Instructions and data are piped from memory to CPU –Basis for imperative languages Variables model memory cells Assignment statements model piping Iteration is efficient

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-10 Von Neumann Architecture

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-11 Influences on Language Design Programming methodologies –1950s and early 1960s Simple applications; worry about machine efficiency –Late 1960s People efficiency became important; readability, better control structures –Structured programming –Top-down design and step-wise refinement –Late 1970s Process-oriented to data-oriented –data abstraction –Middle 1980s Object-oriented programming

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-12 Language Categories Imperative –Central features are variables, assignment statements, and iteration –C, Pascal

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-13 Language Categories Factorial in C #include long factorial (int n); void main(void) { printf("The factorial of %d is %d\n", 10, factorial (10)); } long factorial (int n) { int i; long product =1; for(i = n; i>0); i--) product = product *i; return product; }

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-14 Language Categories Functional –Main means of making computations is by applying functions to given parameters –LISP, Scheme –Factorial in Lisp => (defun factorial (n) (cond ((= n 0) 1) (t (* n (factorial (- n 1)))) )) => (factorial 10)

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-15 Language Categories Object-oriented –Encapsulate data objects with processing –Inheritance and dynamic type binding –Grew out of imperative languages –C++, Java

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-16 Language Categories Factorial in Java import java.io.*; public class Factorial {private long product = 1; private int n; public Factorial(int k) {n = k;} void run (void) {int i; for (i = n; n > 0; i--) product = product *i; System.out.println("The factorial of " + n + "is " + product); } public static void main (void) {Factorial fact10 = new Factorial(10); fact10.run(); } => java Factorial

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-17 Language Categories Logic –Rule-based knowledge base –Rules are specified in no special order –Prolog –Factorial in Prolog factorial(0, 1). factorial(N, F) :- N>0, factorial(N1, F1), N is N1 + 1, F is F1 * N. =>?factorial(10, what). => True.

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-18 Language Design Trade-Offs Criteria in conflict –Reliability vs. cost of execution –Readability vs. writability –Flexibility vs. safety

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-19 Layered View of Computer

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-20 Implementation Methods Compilation –Translate high-level program to machine code –Slow translation –Fast execution

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-21 Compilation Process

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-22 Implementation Methods Pure interpretation –No translation –Slow execution –Becoming rare –Used most in scripting languages

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-23 Pure Interpretation

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-24 Implementation Methods Hybrid implementation systems –Small translation cost –Medium execution speed Two-level compilation –Intermediate code interpretation replaced by JIT (Just In Time) compilation

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-25 Hybrid Implementation System

Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-26 Programming Environments The collection of tools used in software development UNIX –An older operating system and tool collection Borland JBuilder –An integrated development environment for Java Microsoft Visual Studio.NET –A large, complex visual environment –Used to program in C#, Visual BASIC.NET, Jscript, J#, or C++