21
Programming Languages Concepts Lecture 1: Preliminaries Prof. Nidal F. Shilbayeh

Lecture 1- Nidal Preliminaries

Embed Size (px)

Citation preview

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 1/21

Programming Languages Concepts

Lecture 1: Preliminaries

Prof. Nidal F. Shilbayeh

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 2/21

Prof. Nidal F. Shilbayeh2

Chapter 1: Preliminaries

Reasons for Studying Concepts ofProgramming Languages

Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories

Language Design Tradeoffs Implementation Methods Programming Environments

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 3/21

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 4/21

Prof. Nidal F. Shilbayeh4

Increased capacity to express ideas

The language in which software is developedplaces limits on

Control structures

Data structures

Abstractions that can be used

Awareness of a wider variety of programminglanguage features can reduce such limitations

Features in one programming language can often

be simulated in another programming language The study of PLC builds an appreciation for

language features and encourages programmersto use them

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 5/21

Prof. Nidal F. Shilbayeh5

Improved background for choosing

appropriate languages

Many professional programmers have had little formal CS training

CS training in the distant past

As a result, programmers tend to use thelanguage with which they are most familiar,even if it is poorly suited to the task at hand

Familiarity with a wide variety of languagesputs the programmer in a better position tomake informed language choices

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 6/21

Prof. Nidal F. Shilbayeh6

Increased ability to learn new

languages

Learning a new programming language can bedifficult for someone who knows only onelanguage

A thorough understanding of PLC makes itmuch easier to see how language concepts areincorporated into the language being learned Understanding data abstraction facilitates learning

how to construct ADTs in C++ or Java Understanding PLC and its terminology makes it

easier to understand programming language andcompiler manuals

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 7/21

Prof. Nidal F. Shilbayeh7

Better understanding of the

significance of implementation

Understanding how features are implemented

Helps to write efficient codes and improves

debugging skills ability to use a language more intelligently

ability to use a language more efficiently whenthere is a choice among several constructs

Example: recursion vs. iteration

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 8/21

Prof. Nidal F. Shilbayeh8

Increased ability to design new

languages

Programmers occasionally design languagesof some kind or another Software system user interface

interface design involves PLC techniques such aslexical analysis and parsing

Criteria for judging user interface are similar to thoseused to judge programming language designs

The design of a language influences thecomplexity of the algorithms used to translate it

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 9/21

Prof. Nidal F. Shilbayeh9

Overall advancement of computing

Why does a particular programming languagebecome popular?

Best suited to solving problems in a particular domain

Those in positions to choose are familiar with PLC

Those in positions to choose are NOT familiar withPLC

ALGOL 60 vs FORTRAN in the early 60s

ALGOL more elegant with better control statements

Programmers found ALGOL description difficult toread and concepts difficult to understand

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 10/21

Prof. Nidal F. Shilbayeh10

Programming Domains

Scientific applications

Business applications

Artificial intelligence Systems programming

Scripting Languages

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 11/21

Prof. Nidal F. Shilbayeh11

Programming Domains: Scientific

applications

Characterized by the following features: Simple data structures are needed: most

common data structures are arrays and matrices.

Problems require large numbers of floating-pointarithmetic computations.

Most common control structures are countingloops and selections

FORTRAN is the most commonly used language

in this domain.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 12/21

Prof. Nidal F. Shilbayeh12

Programming Domains: Business

applications

Characterized by the following features: Production of elaborate reports Need of precise ways for describing and storing

character data (strings) and decimal numbers. Ability to specify decimal arithmetic operations COBOL is the most commonly used language in

this domain.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 13/21

Prof. Nidal F. Shilbayeh13

Programming Domains: Artificial

intelligence

Symbols rather than numbers manipulated AI problems (game playing, theorem proving,

knowledge representation and reasoning, natural

language processing, . . . etc) require information tobe represented in symbolic form rather thannumeric form

Symbolic data is conveniently represented usinglinked lists (for names) and logical formulas (for

facts and rules). The most commonly used languages in this domain

are LISP for list representation of data andPROLOG for logical formula representation of data.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 14/21

Prof. Nidal F. Shilbayeh 14

Programming Domains: Systemsprogramming

Systems software consists of the operating systemand all the programming tools that support acomputer system.

These programs are mainly used for the operationof the computer system.

A language used to write software in this domainmust provide low-level features that allow software

interfaces to external devices to be written. Theymust also provide for fast execution.

C is the most commonly used system programminglanguage. Includes OS and support tools.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 15/21

Prof. Nidal F. Shilbayeh 15

Programming Domains: ScriptingLanguages

A script is a file that contains a list ofcommands to be executed by an operatingsystem.

A scripting language is used to describescripts.

These languages also have variables,

control flow statements and functionsAmong other capabilities.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 16/21

Prof. Nidal F. Shilbayeh 16

Programming Domains: ScriptingLanguages (Cont.)

Some of these languages are:

Ksh : is powerful and widely known.

awk : began as a report generation language; but hasdeveloped to a general purpose language.

perl : convenient to write Common Gateway Interface (CGI)programs for the World Wide Web.

JaveScript:  used to develop programs for Web servers andbrowsers. It is used mostly as a client-side scripting language:JavaScript code is embedded in HTML documents and is

interpreted by a browser that displays the document. PHP : is a scripting language for use on Web server systems.

Like JavaScript, PHP code is embedded in HTLM documents,and is interpreted on the server before the document is sent toa requesting browser.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 17/21

Prof. Nidal F. Shilbayeh 17

Programming Domains: SpecialPurpose Languages

The simulation of discrete systems is done bymodeling these systems with a series of statechanges. For example, in the simulation of a sodamachine system, the state of the system can bethe amount of coins received so far and the typesof soda cans remaining with their quantities.

A simulation technique follows the system

elements through their change of state andgathering quantitative or factual information. Thisinformation is then used to predict the propertiesof the system under hypothetical situations.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 18/21

Prof. Nidal F. Shilbayeh 18

Programming Domains: SpecialPurpose Languages

RPG (Report Program Generator): wasintroduced by IBM in the 1960s for thegeneration of reports. It has a fixed coding

structure with formats for: input specification (files and data)

switch specification (Boolean)

calculation and process

output specification

Newer versions of RPG are effectivealternatives to COBOL for a wide range ofcommercial work.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 19/21

Prof. Nidal F. Shilbayeh 19

Programming Domains: SpecialPurpose Languages (Cont.)

GPSS (General -Purpose Simulation System) is asimulation language that provides the user with aset of different block types to represent the

activities of the system being simulated. The line joining the blocks indicates the logical sequence inwhich the activities can be executed.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 20/21

Prof. Nidal F. Shilbayeh 20

Programming Domains: SpecialPurpose Languages (Cont.)

SIMULA is a language for system descriptionand simulation with the concept of class (nowadapted and used in object-oriented languages

such as Ada, C++, Smalltalk, . . . etc). A system in this case is viewed as a collection of

independent entities (objects) interacting with eachother. For example, for the soda machine system,

the entities could be the soda machine, the cancontainer, and the users.

Systems are simulated by examining the life cyclesof the entities of the system.

Chapter 1: Preliminaries

8/3/2019 Lecture 1- Nidal Preliminaries

http://slidepdf.com/reader/full/lecture-1-nidal-preliminaries 21/21

Prof. Nidal F. Shilbayeh 21

Programming Domains: General

Purpose Languages

A general-purpose language combinesfeatures from scientific applications

and business applications domains.An example of a general purposelanguage is Ada.

Chapter 1: Preliminaries