week1.ppt

nazimsattar 237 views 37 slides Dec 20, 2022
Slide 1
Slide 1 of 37
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37

About This Presentation

Introduction to programming languages


Slide Content

© Dr. Khalid Nazim S.A.
B.E., M. Tech, MBA[IT], PhD, LMISTE, LMCSI, MIE
Assistant Professor,
Department of Computer Science & Information,
Majmaah University, Az-Zulfi Campus, KSA.
CSI 513: Concepts Of Programming Languages

Concepts Of Programming Languages
Pre-Requisite : CSI 222(Discrete Mathematics2)
Sub Code : CSI 513
Group : 485/486
IA Marks : 60
No. of Lecture Hrs. /week: 03
Exam Hrs. : 02
Total No. of Lecture Hrs.: 45
Exam Marks : 40

Syllabus
1.Introduction1:
Programminglanguagesspectrum,programmingenvironments,
evolutionofmajorprogramminglanguages,Zuse’sPlankalkül,
Functionalprogramming,computerizingbusinessrecords,time
Sharing.
2.Introduction2:
DescribingSyntax&Semantics,Names,Bindings,andScopes.
3.ControlFlow:
ExpressionsandAssignmentStatements,Statement-LevelControl
Structures.
4.DataTypes:
Introduction,differentdatatypesandtheirscopeinprogramming.
5.Subprograms&ControlAbstraction:
fundamentals,parameterpassing,Exceptionhandling
6.DataAbstractionandObjectorientedOrientation:
conceptofdataabstraction,designissuesofobjectoriented
programminglanguages,inheritance,andencapsulation.
7.FunctionallanguagesandLogicalLanguages:
FunctionalLanguages:Origins;Concepts,Areview/overviewof
scheme,comparisonoffunctionalandimperativelanguages,
LogicLanguages:Concepts;Prolog;Logicprogrammingin
perspective,applications.
8.Concurrency:
Introduction,Semaphores,Monitors,MessagePassing,Concurrencyin
FunctionalLanguages,Statement-LevelConcurrency.

Book Type Title and Author Edition Publication Year
Main Text Book (T1)
Robert W. Sebesta, Concepts of
Programming languages
10
th
Ed
Addison-Wesley edition 2013
Reference Books:
Reference Text Book (R1)
David A. Watt, Programming Language
Design Concepts
Wiley
May
2004
Reference Text Book (R2)
SaraBaaseandAllenVanGelder,
ComputerAlgorithms:Introductionto
Design&Analysis
3
rd
Ed Addison-Wesley edition 2000
TextBooks

Self learning
20-30%
Exam
Course Name NO
Mid Term / Quizzes
30-40%
Final
40%
Skills
10-15%
Homework
10-20%
Lab Elec. OralWritten
Others
(group Project)
Participation
(Lab tests)
PresentationQMQMQMQM
05050505-10510--51040%
Concepts of
Programming
Languages
1
Participation: exercise, activities, workshops, field visits,……………
Others: reports, problem sheets, group projects, posters, articles, researches,………………
Portfolio: Students should provide evidence for their achievement of learning outcomes,………………
1.Participation includes:
a.Exerciseprogramsinc++programminglanguagetounderstandtheconceptsofprogramming
followedbylabassessmentforcycle1+cycle2ofprogramsexecutedduringregularlabsessions.
2. Others includes:
a.Group Project.
3. Homework + Assignment includes:
a. Analysis of different programming languages with programming perspective.

Scheme of Evaluation
Component Duration Weight age
Test 1(written) 60 Minutes 10+05 Marks
Test 2 (Online) 60 Minutes 10+05 Marks
Laboratory Work(Attendance + Participation)
During regular class hours
10 Marks
Lab –Group projects(others) 05 Marks
Others(Participation-field visit) 05 Marks
Homework + Assignment 05 Marks
Seminar / Presentation 05 Marks
Final Examination 2 Hours 40 Marks
Total100 Marks
Marks required to Pass the Course 60 Marks

Upon completion of this course, the student should be able to:
Increased ability to express ideas
Improved background for choosing appropriate
languages
Increased ability to learn new languages
Better understanding of significance of
implementation
Better use of languages that are already known
Overall advancement of computing
COURSE OBJECTIVES

Week 1 & 2
Topics to be Discussed:
Introduction 1:
1. Reasons for Studying Concepts of Programming Languages
2. Programming Domains
3. Language Evaluation Criteria
4. Influences on Language Design
5. Language Categories
6. Language Design Trade-Offs
7. Implementation Methods
8. Programming Environments
9.Zuse’s Plankalkül
10.Minimal Hardware Programming: Pseudocodes
11.The IBM 704 and Fortran
12.Functional Programming: LISP
13.The First Step Toward Sophistication: ALGOL 60
14.Computerizing Business Records: COBOL
15.The Beginnings of Timesharing: BASIC

Programming Domains
Scientific applications
Large numbers of floating point computations; use of
arrays
Fortran
Business applications
Produce reports, use decimal numbers and characters
COBOL
Artificial intelligence
Symbols rather than numbers manipulated; use of
linked lists
LISP
Systems programming
Need efficiency because of continuous use
C
Web Software
Eclectic collection of languages: markup (e.g., HTML),
scripting (e.g., PHP), general-purpose (e.g., Java)

Language Evaluation Criteria
Readability:
The ease with which programs can be read and
understood
Writability:
The ease with which a language can be used to
create programs
Reliability:
Conformance to specifications (i.e., performs
to its specifications)
Cost:
The ultimate total cost

Evaluation Criteria: Readability
A. Overall simplicity
I.A manageable set of features and constructs
II.Minimal feature multiplicity
III.Minimal operator overloading
B. Orthogonality
I.A relatively small set of primitive constructs can be combined in a relatively
II.small number of ways
III.Every possible combination is legal
C. Data types
I.Adequate predefined data types
D. Syntax considerations
I.Identifier forms: flexible composition
II.Special words and methods of forming compound statements
III.Form and meaning: self-descriptive constructs, meaningful keywords

Evaluation Criteria: Writability
A. Simplicity and orthogonality
Few constructs, a small number of primitives, a small set of rules for
combining them
B. Support for abstraction
The ability to define and use complex structures or operations in
ways that allow details to be ignored
C. Expressivity
i.A set of relatively convenient ways of specifying operations
ii.Strength and number of operators and predefined functions

Evaluation Criteria: Reliability
A. Type checking
Testing for type errors
B. Exception handling
Intercept run-time errors and take corrective measures
C. Aliasing
Presence of two or more distinct referencing methods for the
same memory location
D. Readability and Writability
Alanguagethatdoesnotsupport“natural”waysof
expressinganalgorithmwillrequiretheuseof“unnatural”
approaches,andhencereducedreliability

Evaluation Criteria: Cost
1.TrainingProgrammerstousethelanguage
2.WritingPrograms(closenesstoparticularapplications)
3.CompilingPrograms
4.ExecutingPrograms
5.LanguageImplementationSystem:
Availabilityoffreecompilers
6.Reliability:
Poorreliabilityleadstohighcosts
7.MaintainingPrograms

Evaluation Criteria: Others
A. Portability
The ease with which programs can be moved from one
implementation to another
B. Generality
The applicability to a wide range of applications
C.Well-defined ness
The completeness and precision of the language’s official
definition

Influences on Language Design
Computer Architecture:
Languages are developed around the prevalent computer
architecture, known as the Von Neumannarchitecture
Program Design Methodologies:
New software development methodologies (e.g., object-
oriented software development) led to new programming
paradigms and by extension, new programming languages

Computer Architecture Influence
1.Well-known computer architecture: Von Neumann
2.Imperative languages, most dominant, because of von
Neumann computers
i.Data and programs stored in memory
ii.Memory is separate from CPU
iii.Instructions and data are piped from memory to CPU
3. Basis for imperative languages
i.Variables model memory cells
ii.Assignment statements model piping
iii.Iteration is efficient

The Von Neumann Architecture

The Von Neumann Architecture
Fetch-execute-cycle (on a von Neumann architecture computer)
initialize the program counter
repeatforever
fetch the instruction pointed by the counter
increment the counter
decode the instruction
execute the instruction
end repeat

Programming Methodologies Influences
A.1950s and early 1960s:
Simple applications; worry about machine efficiency
B. Late 1960s:
People efficiency became important; readability, better control structures
i.Structured programming
ii.Top-down design and step-wise refinement
C. Late 1970s: Process-oriented to data-oriented
Data abstraction
D. Middle 1980s: Object-oriented programming
Data abstraction + Inheritance + Polymorphism

Language Categories
A.Imperative (An imperative languageuses a sequence of statements to determine how to reach a certain goal)
i.Central features are variables, assignment statements, and iteration
ii.Include languages that support object-oriented programming
iii.Include scripting languages
iv.Include the visual languages
Examples: C, Java, Perl, JavaScript, Visual BASIC .NET, C++
B.Functional
Main means of making computations is by applying functions to given parameters
Examples: LISP, Scheme, ML, F#
C.Logic
Rule-based (rules are specified in no particular order)
Example: Prolog
D.Markup/programming hybrid
Markup languages extended to support some programming
Examples:
JSTL(Java Standard Tag Library),
XSLT(Extensible Stylesheet Language Transformations)

Language Design Trade-Offs
A.Reliability vs. cost of execution
Example:
Java demands all references to array elements be checked for proper
indexing, which leads to increased execution costs
B.Readability vs. Writability
Example:
APL provides many powerful operators (and a large number of new symbols),
allowing complex computations to be written in a compact program but at the
cost of poor readability
C.Writability (flexibility) vs. reliability
Example:
C++ pointers are powerful and very flexible but are unreliable

Implementation Methods
A.Compilation
i.Programs are translated into machine language; includes JIT systems
Use: Large commercial applications
B.Pure Interpretation
i.Programs are interpreted by another program known as an
interpreter
Use: Small programs or when efficiency is not an issue
C.Hybrid Implementation Systems
i.A compromise between compilers and pure interpreters
Use: Small and medium systems when efficiency is not the first concern

Layered View of Computer
The operating system and language implementation
are layered over machine interface of a computer

Compilation
A.Translate high-level program (source language) into machine code
(machine language)
B.Slow translation, fast execution
C.Compilation process has several phases:
i.Lexical analysis:
converts characters in the source program into lexical units
ii. Syntax analysis:
Transforms lexical units into parse trees which represent the
syntactic structure of program
iii.Semantics analysis: generate intermediate code
iv.Code generation: machine code is generated

The Compilation Process

Additional Compilation Terminologies
A.Load module(executable image):
The user and system code together
B.Linking and loading:
The process of collecting system program units and
linking them to a user program

Von Neumann Bottleneck
•Connectionspeedbetweenacomputer’smemoryandits
processordeterminestheSpeedofacomputer.
•Programinstructionsoftencanbeexecutedmuchfasterthan
thespeedoftheconnection;theconnectionspeedthusresults
inabottleneck.
•KnownastheVonNeumannbottleneck;
Itistheprimarylimitingfactorinthespeedof
computers.

Pure Interpretation
1.Notranslation.
2.Easierimplementationofprograms
(run-timeerrorscaneasilyandimmediatelybedisplayed)
3.Slowerexecution.
(10to100timesslowerthancompiledprograms)
4.Oftenrequiresmorespace
5.Nowrarefortraditionalhigh-levellanguages.
6.SignificantcomebackwithsomeWebscriptinglanguages.
(e.g.,JavaScript,PHP)

Pure Interpretation Process

Hybrid Implementation Systems
1.A compromise between compilers and pure interpreters.
2.A high-level language program is translated to an intermediate language
that allows easy interpretation.
3.Faster than pure interpretation.
Examples:
i.Perl programs are partially compiled to detect errors before
interpretation.
ii.Initial implementations of Java were hybrid.
iii.The intermediate form, byte code, provides portability to any
machine that has a byte code interpreter and a run-time system
(together, these are called Java Virtual Machine)

Hybrid Implementation Process

Just-in-Time Implementation Systems
1.Initially translate programs to an intermediate language.
2.Then compile the intermediate language of the subprograms
into machine code when they are called.
3.Machine code version is kept for subsequent calls.
4.JIT systems are widely used for Java programs.
5..NET languages are implemented with a JIT system.
6.In essence, JIT systems are delayed compilers.

Preprocessors
I.Preprocessormacros(instructions)arecommonlyusedto
specifythatcodefromanotherfileistobeincluded.
II.Apreprocessorprocessesaprogramimmediatelybefore
theprogramiscompiledtoexpandembedded
preprocessormacros.
III.Awell-knownexample:
Cpreprocessor
–expands#include,#define,andsimilarmacros

Programming Environments
A.A Collection of tools used in software development.
B.UNIX
i.An older operating system and tool collection.
ii.Nowadays often used through a GUI (e.g., CDE, KDE, or GNOME)
that runs on top of UNIX.
C.Microsoft Visual Studio.NET
A large, complex visual environment.
D.Used to build Web applications and non-Web applications in any .NET
language.
E.NetBeans
Related to Visual Studio .NET, except for applications in Java.

Summary
1. The study of programming languages is valuable for a number of reasons:
i.Increase our capacity to use different constructs
ii.Enable us to choose languages more intelligently
iii.Makes learning new languages easier
2. Most important criteria for evaluating programming languages include:
a. Readability,
b. Writability,
c. Reliability,
d. Cost.
3. Major influences on language design have been machine architecture and
software development methodologies
4. The major methods of implementing programming languages are:
a. Compilation,
b. Pure Interpretation,
c. Hybrid Implementation.
Tags