ICS 313 Fundamentals of Programming Languages Spring Semester 2004 - 2005 (042) King Fahd University of Petroleum & Minerals Information & Computer Science.

Slides:



Advertisements
Similar presentations
Introduction to Programming Languages Nai-Wei Lin Department of Computer Science and Information Engineering National Chung Cheng University.
Advertisements

Copyright © 1998 by Addison Wesley Longman, Inc. 1 Chapter One Preliminaries, including –Why study PL concepts? –Programming domains –PL evaluation criteria.
Chapter 1: Preliminaries
Programming Languages Language Design Issues Why study programming languages Language development Software architectures Design goals Attributes of a good.
PLLab, NTHU Cs2403 Programming Languages Implementation Issues Cs2403 Programming Language Spring 2005 Kun-Yuan Hsieh.
SWE 423 Multimedia Systems Section 01 – 10:00-10:50am – 23:014 Fall Semester (061) King Fahd University of Petroleum & Minerals Information.
SWE 415: Software Testing and Quality Assurance Section 01, 12:00-12:50pm, 22:130 Spring Semester (072) King Fahd University of Petroleum &
SWE 423 Multimedia Systems Section 01 – 10:00-10:50am – 24:108 Fall Semester (071) King Fahd University of Petroleum & Minerals Information.
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.
CS 330 Programming Languages 09 / 06 / 2007 Instructor: Michael Eckmann.
Programming Languages Structure
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Summer 02-03Programming Language Concepts1 Programming Language Concepts (CS 360) Lecture 1: Overview, Grammars, and Little Languages Jeremy R. Johnson.
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
SWE 423 Multimedia Systems Section 01 – 01:10-02:00 p.m. – Bldg. 24 – Room 153 Second Semester 2006/2007 (062) King Fahd University of Petroleum & Minerals.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Concepts of Programming Languages Chapter 1.
ICE1341 Programming Languages Spring 2005 Lecture #3 Lecture #3 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Programming Language Concepts
CS 331, Principles of Programming Languages Introduction.
CS 355 – Programming Languages
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
CS 363 Comparative Programming Languages
CS 330 Programming Languages 09 / 04 / 2008 Instructor: Michael Eckmann.
Programming Languages Summer
Programming Languages –14 David Watt (Glasgow) Steven Wong (Singapore) Moodle : Computing Science → Level 3 → Programming Languages 3 © 2012 David.
February 25, ICE 1341 – Programming Languages (Lecture #1) In-Young Ko Programming Languages (ICE 1341) Lecture #1 Programming Languages (ICE 1341)
1 Programming Languages Marjan Sirjani Course web site:
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.
ISBN Chapter 1 Preliminaries. Copyright © 2009 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
Programming Domains 1.Scientific Applications Typically, scientific applications have simple data structures but require large numbers of floating-point.
Programming Language Concepts (CIS 635) Elsa L Gunter 4303 GITC NJIT,
ICS202 Data Structures King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science Department.
CS 331, Principles of Programming Languages Chapter 1.
Engr. Isabelo Jun D. Paat, ME-CoE Lecturer 1 Programming Languages.
Course No Programming Languages Theory & Practice First Semester ITTIHAD UNIVERSITY Computer Science Department Instructor: Dr. Rafiqul.
ISBN Structure of Programming Languages Prof. Dr. Mostafa Abdel Aziem Mostafa Senior Lecturer
ICS 313 Fundamentals of Programming Languages. Catalogue Description  Concepts of Programming Languages: Syntax and semantics, Data types, Control structures,
Chapter 1: Preliminaries Lecture # 2. Chapter 1: Preliminaries Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation.
CSCE 343 – Programming Language Concepts Welcome!.
Scott C. Johnson Lecturer Rochester Institute of Technology Spring 2016.
Concepts of Programming Languages
Introduction to programming languages, Algorithms & flowcharts
Concepts of Programming Languages
CSCI 3370: Principles of Programming Languages Introduction
Why study programming languages?
Chapter 1 Preliminaries.
Introduction to programming languages, Algorithms & flowcharts
PROGRAMMING LANGUAGES
Chapter 1 Reasons to study concepts of PLs Programming Domains
1.1 Reasons to study concepts of PLs
Chapter 1 Preliminaries.
Introduction to programming languages, Algorithms & flowcharts
CS 3304 Comparative Languages Fall 2011
Chapter 1 Introduction.
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.
CS 3304 Comparative Languages Fall 2011
Chapter 1 Preliminaries.
Programming Languages, Preliminaries, History & Evolution
Reasons To Study Programming Languages
Chapter 1 Preliminaries.
Presentation transcript:

ICS 313 Fundamentals of Programming Languages Spring Semester (042) King Fahd University of Petroleum & Minerals Information & Computer Science Department

Section 04, 10:00-11:15am UT, 24:250 Instructor: Dr. Wasfi Al-Khatib وصفي الخطيب Office: 22: Office Hours: UT: 9:00 - 9:50am and 2:30 – 3:30pm M: 3:00 - 4:00pm Or by appointment Phone: WebCT Page:

Catalogue Description Concepts of Programming Languages: Syntax and semantics, Data types, Control structures, Subprograms, Exception handling, Run-time storage management. Programming paradigms: Imperative, functional, logical, object-oriented and concurrent programming

Course Objectives Outline the history and describe the rationale of different programming languages. Describe grammar and syntax specifications and analyze their implementations. Describe, analyze and use the various mechanisms in procedural languages; e g. data types, scope, control structures subprograms, etc. Describe and use the major programming paradigms: Imperative, Functional, Logical and Object-Oriented. Explain and describe how concurrency and exception handling are used in programming Languages

Text Book Concepts of Programming Languages, By. R. Sebesta, 6th Ed, Addison Wesley, 2004.

Course Outline 1.Preliminaries 2.Evolution of the Major Programming languages 3.Describing Syntax and Semantics 4.Imperative Programming (Introduction to C) 5.Functional Programming 6.Logic Programming 7.Names, Bindings, Type Checking and Scopes 8.Data Types 9.Expressions and the Assignment Statements 10.Statement-Level Control Structure 11.Subprograms 12.Implementing Subprograms 13.Abstract Data Types

Grading Policy [Programming] Assignments20% Pop Quizzes10% Major Exam #110% Major Exam #215% Major Exam #320% Final Exam25%

Important Dates TaskDate [and Time]LocationWeight Help Session ITBA N/A Major Exam ISaturday March 5, :30 – 8:00pmTBA10% Help Session IITBA N/A Major Exam IISaturday March 26, :30 – 8:00pmTBA15% Help Session IIITBA N/A Major Exam IIISaturday April 30, :30 – 8:00pmTBA20% Help Session IVTBA N/A Final ExamTBA 25%

Attendance Policy Attendance will be checked each class. Unexcused Absences Policies: –The first THREE absences are FREE of charge. –The fourth absence is worth – 3 points of your overall score (out of 100). –Each subsequent absence, up to the sixth absence, is worth of your overall score. –The seventh absence will result in an automatic DN grade. –An unexcused absence can become an excused absence ONLY by an official letter from the Dean of Student ’ s office.

General Rules Students are expected to be courteous toward the instructor and their classmates throughout the duration of this course. All cell phones and pagers must be turned off during class and exams. Assignments are due at the beginning of class. No late assignment will be accepted. Discussing questions among your classmates is highly encouraged. Copying solutions from each other is NOT permitted and will be considered CHEATING and will be dealt with accordingly.

Pop Quizzes 10 minute Each covers material given during the current lecture. They require you to be attentive during class time as you will be subject at any point in time to answer a pop-quiz.

IMPORTANT RULE ZERO-TOLERANCE for CHEATING.

Exam Policies 24-Hour Policy: One has 24 hours to object to the score of an assignment, a pop quiz, or a major exam from the end of the class time in which the graded assignment/quiz/exam papers have been distributed. If for some reason you cannot contact me in person within this period, send me an requesting an appointment. The should be sent within the 24-hour time period. Exams, assignments and pop-quizzes are generally CHALLENGING.

1. Preliminaries

Reasons to study concepts of PLs Increased capacity to express programming concepts Improved background for choosing appropriate languages Increased ability to learn new languages Understanding the significance of implementation Increased ability to design new languages Overall advancement of computing

Programming Domains Scientific applications Business applications Artificial intelligence Systems programming Scripting languages Special purpose languages

What is a Programming Language A programming language is

Programming Language Definition Language Syntax –Grammar and punctuation. –Superset of legal languages. Language Semantics –What the syntax means. –Restricts syntactically correct programs.

Computer Program Development Algorithm Syntax Computer Program Problem Human brains Semantics Translation Algorithm Syntax

Why Take This Course? In order to graduate 1.True 2.False 3.Not necessarily 4.None of the above Learning a new language depends on how many languages you learn 1.True 2.False 3.Not necessarily 4.None of the above

Programming Paradigms Imperative –Program = Algorithms + Data Functional –Program = Function o Function Object-Oriented –Program = Objects + Messages Logic –Program = Facts + Rules Special-purpose

Imperative Programming Oldest style of Programming Algorithm is expressed as a sequence of instructions, e.g. assignment, looping, … For example, assembly, Fortran, Algol, Pascal, and C.

Example in C Finding the greatest common divisor between two elements #include void main() { int x,y; printf("enter any two numbers"); scanf("%d %d",&x,&y); if(x<0)x=-x; if(y<0)y=-y; while(x!=y) x>y?(x=x-y):(y=y-x); printf("gcd of the numbers is %d",x); }

Functional Programming Comes from traditional Mathematics. Description of computation is based on the evaluation of functions or the application of functions to known values. No notion of variables or assignment to variables! Loops are replaced by recursion! For example Lisp, Scheme, ML, Haskell.

Example in Scheme Finding the greatest common divisor between two elements (define (gcd u v) (if (= v 0) u (gcd v (remainder u v))))

Object Oriented Programming Based on class and inheritance Instead of applying global functions to variables, “ methods ” associated with instances are invoked (message passing) For example, C++, Java, Smalltalk, …

Example in C++ // gcd.cpp - long integer greatest common divisor class BadGcdArgumentsException{ }; long gcd(long a,long b) // Euclidean algorithm - returns 0 // if a and b are both 0. { long r; // First make sure everything is >= 0. if(a < 0) a = -a; if(b < 0) b = -b; // If both arguments are 0, throw an exception. if(a == 0 && b == 0) throw BadGcdArgumentsException(); // Otherwise the gcd of 0 and x is x. if(a == 0) return(b); if(b == 0) return(a); // Keep dividing until we get a zero remainder. The last // nonzero remainder is the gcd. while(b > 0) { r = a % b; a = b; b = r; } return(a); } Finding the greatest common divisor between two elements

Logic Programming Like functional programming, but through formal logic. A program is a set of predicates, i.e. rules governing the problem. Either the truthfulness of a given formula or the deduction of new formulae results from running a logic program. For example, prolog.

Example in Prolog Finding the greatest common divisor between two elements gcd(U,V,U) :- V=0. gcd(U,V,X) :- V>0, Y is U mod V, gcd(V,Y,X).

Special-Purpose Languages Shell, Awk, Perl, Python –System administration –Program configuration Postscript, Tex, RTF –Text and document setting HTML, XML –Markup Language

Example in Perl Make up one pdf file from separate postscript files. # This script takes as input the desired output filename (without the extension) and the # number of input files. It is assumed that the input filenames are of the form 1.ps 2.ps... # 99.ps and so on and so forth. It then combines all postscript files into one file with a.ps # extension. Finally, it will generate the pdf version of the postscript file. $Docs_Dir = 'C:\\Program Files\\ScannerU\\'; $OutputFile = $ARGV[0]; $NumOfInputs = $ARGV[1]; $FileList = ""; for ($i = 1; $i <= $NumOfInputs; $i = $i + 1) { $FileList = $FileList. $i. ".ps "; } chdir($Docs_Dir); system("gswin32c -dNOPAUSE -sDEVICE=pswrite -dBATCH - sOutputFile=". $OutputFile. ".ps ". $FileList); system("ps2pdf -r720 ". $OutputFile. ".ps ". $OutputFile. ".pdf ");

Language Evaluation Criteria Readability –The most important criteria –Factors Overall simplicity –Too many features is bad –Multiplicity of features is bad Orthogonality –Makes the language easy to learn and read –Meaning is context independent Control statements Data type and structures Syntax considerations Writability –Factors Simplicity and orthogonality Support for abstraction Expressivity

Language Evaluation Criteria (cont.) Reliability –Factors Type checking Exception handling Aliasing Readability and writability Cost –Categories Programmer training Software creation Compilation Execution Compiler cost Poor reliability Maintenance Others: portability, generality, well-definedness

Language Design Trade-offs Reliability versus cost of execution Writability versus readability Flexibility versus safety

Layered View of a Computer

Implementation Methods Compilation Interpretation Hybrid Implementation Systems

Compilation Translate high-level program to machine code Slow translation Fast execution

Interpretation No translation Slow execution Usually found in functional and logic- based programming languages.

Hybrid Implementation Systems Small translation cost Medium execution speed

Programming Environments The collection of tools used in software development UNIX –An old operating system and tool collection Borland JBuilder –A PC environment for Java Smalltalk –A language processor/environment Microsoft Visual C++ –A large, complex visual environment