0% found this document useful (0 votes)
55 views

WK 1 Ses 1-2 Introduction To Programming Languages

1. The document discusses the topic of an introduction to programming languages. 2. It identifies two major classes of programming languages: imperative languages and declarative languages. 3. Imperative languages are algorithmic and include block-structured, object-oriented, and distributed programming languages. Declarative languages are based on relations and functions and include functional, logic, and database languages.

Uploaded by

deborah galang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

WK 1 Ses 1-2 Introduction To Programming Languages

1. The document discusses the topic of an introduction to programming languages. 2. It identifies two major classes of programming languages: imperative languages and declarative languages. 3. Imperative languages are algorithmic and include block-structured, object-oriented, and distributed programming languages. Declarative languages are based on relations and functions and include functional, logic, and database languages.

Uploaded by

deborah galang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

F0088

TOPIC TITLE: INTRODUCTION TO PROGRAMMING LANGUAGES

Specific Objectives:

At the end of the topic session, the students are expected to:

Cognitive:

1. Identify the different classes of programming languages.


2. State the reasons for studying programming languages.
3. List a set of evaluation criteria.
4. Name the two major influences on language design, machine
architecture, and program design methodologies.
5. Identify the most common approaches to implementation.

Affective:

1. Listen to others with respect.


2. Participate in class discussions actively.

Psychomotor:

1. Evaluate on the need to study the general concepts of


programming languages.

MATERIALS/EQUIPMENT:

o Topic slides
o OHP

TOPIC PREPARATION:

o Have the students research on the rationale for studying


programming languages.
o It is imperative for the instructor to incorporate various kinds of
teaching strategies while discussing the suggested topics. The
instructor may use the suggested learning activities below to
facilitate a thorough and creative discussion of the topic.
o Prepare the slides to be presented in class.

TOPIC PRESENTATION:

The topic will revolve around concepts of programming languages and


consider a few preliminaries.

This will be the suggested flow of discussion for the course topic:

1. Discuss the two major classes of programming languages and


enumerate their categories.
2. Ask the students on their idea of the reasons for studying
general concepts of programming languages.
3. Explain the importance of setting evaluation criteria.
4. Introduce other factors that influence the basic design of
programming languages.
5. Ask the students to differentiate the different implementation
methods.

Introduction to Programming Languages *Property of STI


Page 1 of 7
F0088

Classes of Programming Classes of Programming Languages


Languages
Page 1 of 12 Programming languages are categorized into two major classes:
Programming Languages
imperative language and declarative language.
Cl asses of Pr ogr am m i n g
Lan gu ages Imperative languages, also called algorithmic languages, are probably
the most prevalent among the programming language paradigms today.
Their programs are constructed as algorithms or as sequences of
 Imperative Languages
 Block -Str u ctu r ed or Pr ocedu r al Lan gu ages executable instructions.
 Object-Or ien ted Lan gu ages
 Lan gu ages for Distr ibu ted Pr ogr am m in g

 Declarative Languages These languages are greatly concerned with variables and include
 Fu n ction al or Applicative Lan gu ages
 Logic Pr ogr am m in g commands for sequentially allocating memory space or CPU locations to
 Lan gu ages for Databases
these variables and for correspondingly changing their values through
assignment statements or procedure execution.

The three main categories of imperative languages are as follows:

• Block-Structured or Procedural Languages – These languages are


process or “how” oriented. Their basic unit of modularization is the
Introduction to Programming Languages * Property of STI
Page 1 of 12

function or the procedure. A modular unit is comprised of a set of


data declarations and statements. Examples include ALGOL,
Pascal, Modula-2, Ada, and C.

• Object-Oriented Languages – These languages are data or “what”


centered and implement the principle of program decomposition,
data abstraction, and information hiding. They are based on the
fundamental concept of objects. Examples include Smalltalk, C++,
Java, and Visual Basic.

• Distributed Programming Languages – These languages support


more than one processor working either simultaneously or
alternately with other processors in order to complete a task or to
solve a problem.

On the other hand, declarative languages are those based on relations


or functions. They include facilities for writing declarations or truths.
Compared to imperative languages, they are considered to have higher
level than the former since they work around concepts and not with a
machine’s storage locations.

The three main categories of declarative languages are as follows:

• Functional or Applicative Languages – These languages consider


the function as their major organizing principle. Examples include
LISP, APL, and ML.

• Logic Programming – This describes computing problems in the


form of predicate logic statements. PROLOG is the first thing that
comes to mind when talking about logic programming.

• Languages for Databases – Languages that support databases


include facilities for accessing/selecting data from database entities,
and describing relationships between data entities. An example
would be SQL.

[Classes of Programming Languages, Page 1 of 12]

Introduction to Programming Languages *Property of STI


Page 2 of 7
F0088

Reasons for Studying Reasons for Studying Programming Languages


Programming Languages
Page 2 of 12 The following is what to believe to be a compelling list of potential
Programming Languages
benefits of studying language concepts:
Reason s f or St u dy i n g
Pr ogr am m i n g Lan gu ages • To understand the language you are using.
• To understand the significance of programming constructs and
 To u n der stan d th e lan gu age you ar e u sin g
implementation.
 To u n der stan d th e sign ifican ce of • To make it easier to learn a new language.

pr ogr am m in g con str u cts an d
im plem en tation To know which programming language to use.

 To m ak e it easier to lear n a n ew lan gu age
 To k n ow wh ich pr ogr am m in g lan gu age to
To design a new language easier.
u se
 To design a n ew lan gu age easier
[Reasons for Studying Programming Languages, Page 2 of 12]

Introduction to Programming Languages * Property of STI


Page 2 of 12

Language Evaluation Criteria Language Evaluation Criteria


Page 3 of 12
A set of evaluation criteria helps the programmers to realize the extent of
Programming Languages

Lan gu age Ev al u at i on
the capabilities of a language and its constructs. This influences
Cr i t er i a computer design and software development greatly.

 Readability Readability
 th e qu ality of a lan gu age th at en ables a
pr ogr am m er to u n der stan d an d com pr eh en d
th e str u ctu r e of pr ogr am s so th at th ey can
This is defined to be the quality of a language that enables a
be easily u n der stood an d r ead
programmer to understand and comprehend the structure of programs
Factor s affectin g r eadability: so that they can be easily understood and read.
 Sim plicity
 Or th ogon ality
 Con tr ol Statem en t Design A programming language’s readability is affected by its simplicity,
 Syn tax
orthogonality, control statement design and syntax.

Orthogonality refers to the control and data structures of a programming


language built from combining a relatively small set of primitive
constructs in a relatively small number of ways. The more orthogonal
Introduction to Programming Languages * Property of STI
Page 3 of 12 the language design is, the fewer exceptions are required by its rules
thus making it simpler and easier to understand.
Page 4 of 12
Effective control statements avoid having to branch out the order of
Programming Languages
execution.
Lan gu age Ev al u at i on
Cr i t er i a Syntax is defined to be the description of the ways different parts of the
language must be constructed to form other parts.
 Writability
 m easu r e of h ow easily an d con ven ien tly a
lan gu age can be u sed to cr eate codes or
pr ogr am s for a par ticu lar pr oblem Writability
Factor s affectin g wr itability: This measures how easily and conveniently a language can be used to
 Sim plicity
create codes or programs for a particular problem.
 Or th ogon ality
 Abstr action
A programming language’s writability is affected by its simplicity,
orthogonality, and abstraction.

Abstraction refers to the ability to define and then use operations on


complicated structures in ways allowing many of the details to be
Introduction to Programming Languages * Property of STI
ignored.
Page 4 of 12

Introduction to Programming Languages *Property of STI


Page 3 of 7
F0088

Page 5 of 12 Reliability
This refers to the ability of a program to perform its specifications under
Programming Languages

all-possible conditions or circumstances.


Lan gu age Ev al u at i on
Cr i t er i a
A programming language’s reliability is affected by type checking,
 Reliability exception handling, aliasing, and its readability and writability.
 th e ability of a pr ogr am to per for m to its
specification s u n der all-possible con dition s
or cir cu m stan ces
Type checking refers to testing for type compatibility between two things.
Factor s affectin g r eliability:
The checking can be done during compile time or run time.
 Type ch eck in g
 Exception Han dlin g
 Aliasin g Exception handling is the ability of a program to detect beforehand
 Readability
 Wr itability errors during run time along with odd results and unusual conditions, to
use corrective measures and to continue and complete execution.

Aliasing is defined as allowing two distinct names or referencing


methods to point to the same memory cell.
Introduction to Programming Languages * Property of STI
Page 5 of 12

Cost
The total cost of a programming language is a combination of many of
Page 6 of 12
its features and characteristics. Of all those which contribute to language
Programming Languages
costs, program development and maintenance are the most important
Lan gu age Ev al u at i on considerations. Since these are functions of readability and writability,
Cr i t er i a they are in turn the most important of the four evaluation criteria.
 Characteristics of Cost
 Pr ogr am m er tr ain in g
The following are the characteristics of cost:


Softwar e cr eation
Com pilation • Programmer training


Execu tion
Com piler cost • Software creation
• Compilation
 Poor r eliability.
 Main ten an ce

• Execution
• Compiler cost
• Poor reliability
• Maintenance

[Language Evaluation Criteria, Pages 3-6 of 12]


Introduction to Programming Languages * Property of STI
Page 6 of 12

Influences on Language Design Influences on Language Design


Page 7 of 12
Computer Architecture
Programming Languages

I n f l u en ces on
Most of the popular languages of the last 45 years have been designed
Lan gu age Desi gn around the prevalent von Neumann architecture. These languages are
called imperative languages. von Neumann computer architecture
 Com pu ter Ar ch itectu r e basics:
 stores data and program in the same memory, while the CPU
 Most of th e popu lar lan gu ages of th e last 45
year s h ave been design ed ar ou n d th e
pr evalen t von Neu m an n ar ch itectu r e
 Th ese lan gu ages ar e called imperative
languages which executes instructions is separated from memory
 von Neu m an n com pu ter ar ch itectu r e basics:
• st or es dat a and pr ogr am in t he sam e m em or y,
while t he CPU which execu t es inst r u ct ions is
 instructions and data must be piped from memory to the CPU
separ at e fr om m em or y
• inst r u ct ions and dat a m u st be piped fr om and the results moved back to memory
m em or y t o t he CPU and t he r esu lt s m oved
back t o m em or y
 cen tr al featu r es of im per ative lan gu ages ar e:
• var iables which m odel t he m em or y cell
• assignm ent st at em ent s based on t he piping Because of von Neumann, the central features of imperative languages
oper at ion
• oper ands in expr essions ar e piped fr om
m em or y t o t he CPU, and t he r esu lt of
are:
evalu at ing t he expr ession is piped back t o t he
m em or y cell r epr esent ing t he left side of t he
assignm ent
 variables which model the memory cell
• t he it er at ive for m of r epet it ion
• inst r u ct ions ar e st or ed in adjacent cells in  assignment statements based on the piping operation
 operands in expressions are piped from memory to the CPU,
m em or y so it er at ion is fast in t his ar chit ect u r e

Introduction to Programming Languages * Property of STI


Page 7 of 12 and the result of evaluating the expression is piped back to the
memory cell representing the left side of the assignment
 the iterative form of repetition
 instructions are stored in adjacent cells in memory so iteration is
fast in this architecture

Introduction to Programming Languages *Property of STI


Page 4 of 7
F0088

Page 8 of 12 Programming Methodologies


In 1950s and early 1960s, simple applications worry about machine
Programming Languages

efficiency. In the late 1960s, people efficiency became important –


I n f l u en ces on
Lan gu age Desi gn readability and better control structures. In the late 1970s, top-design
and stepwise were refined. Incompleteness of type checking was
 Pr ogr am m in g Meth odologies discovered and the control statements were inadequate.
 1950s an d ear ly 1960s: Sim ple application s
– wor r y abou t m ach in e efficien cy
 Late 1960s: People efficien cy becam e
im por tan t – r eadability an d better con tr ol
str u ctu r es
In the middle of 1980s, object-oriented programming added inheritance
 Late 1970s:
• Top-design and st epwise r efinem ent and dynamic method binding which enhance the potential reuse of
• Discover y of incom plet eness of t ype check ing


and inadequ acy of cont r ol st at em ent s
Middle 1980s: Object-or ien ted pr ogr am m in g
existing software.
• Added inher it ance and dynam ic m et hod
binding which enhance t he pot ent ial r eu se of
exist ing soft war e
[Influences of Language Design, Pages 7-8 of 12]

Introduction to Programming Languages * Property of STI


Page 8 of 12

Implementation Methods Implementation Methods


Page 9 of 12
The two primary components of a computer are its processor and its
Programming Languages

I m pl em en t at i on
internal memory. The internal memory is used to store programs and
M et h ods data. While the processor is a collection of circuits that provides a
realization of a set of primitive operations, or machine instructions, such
 Processor as those for arithmetic and logic operations.
 com posed of cir cu its th at execu te a set of
m ach in e in str u ction s, or m acr oin str u ction s
 Internal M emory
 u sed by th e pr ocessor to stor e data an d
in str u ction s
The figure below illustrates layered view of a computer.

Lay er ed Vi ew of a Com pu t er
Introduction to Programming Languages * Property of STI
Page 9 of 12

Programming is usually carried out in a high-level language quite distant


from a computer’s machine language.

[Implementation Methods, Page 9 of 12]

Introduction to Programming Languages *Property of STI


Page 5 of 7
F0088

Compilation Compilation
Page 10 of 12
Compilation or translation translates high-level language programs into
Programming Languages

equivalent programs in machine language.


Com pi l at i on
A compiler is a translator that has a high-level language for its source
 tr an slates h igh -level lan gu age pr ogr am s language and an object language close to the machine language of an
in to equ ivalen t pr ogr am s in m ach in e
lan gu age actual computer.

An al y si s
The stages of compilation are analysis and synthesis. These two are
COM PI LER further subdivided into several phases. Analysis includes lexical
analysis, syntax analysis, and intermediate code generation phases. On
Sy n t h esi s
the other hand, the synthesis is composed of code optimization and
code generation phases. Refer to the figure below.

An al y si s
Introduction to Programming Languages * Property of STI
Page 10 of 12

COM PI LER

Sy n t h esi s

[Compilation, Page 10 of 12]

Pure Interpretation Pure Interpretation


Page 11 of 12
Pure interpretation is a method of software simulation, which translates
Programming Languages

high-level language programs by interpreting them through software


Pu r e I n t er pr et at i on simulation of a computer whose machine language is the high-level
language itself.
 A m eth od of softwar e sim u lation wh ich
tr an slates h igh -level lan gu age pr ogr am s by
in ter pr etin g th em th r ou gh softwar e
sim u lation of a com pu ter , u sin g h igh -level
Pure interpretation has the advantage of allowing easy implementation
lan gu age. of many source-level debugging operations, because all run-time error
 Advan tage: messages can refer to source-level units.
 allow easy im plem en tation of m an y sou r ce-
level debu ggin g oper ation s

 Disadvan tages: However, it has its disadvantage of executing 10 to 100 times slower
 slow execu tion
 r equ ir es m or e space than in compiled systems. The primary source of this slowness is the
decoding of high-level language statements, which are far more complex
than machine language instructions. In addition, it often requires more
space.
Introduction to Programming Languages * Property of STI
Page 11 of 12 [Pure Interpretation, Page 11 of 12]

Introduction to Programming Languages *Property of STI


Page 6 of 7
F0088

Hybrid Implementation Systems Hybrid Implementation Systems


Page 12 of 12
These translate source programs into intermediate code-like versions
Programming Languages

Hy br i d I m pl em en t at i on
and then decode and accomplish them through interpretation, as
Sy st em s illustrated in the figure below. This saves more time than pure
interpretation or software simulation because source language
 sou r ce pr ogr am s in to in ter m ediate code- statements are decoded only once.
lik e ver sion s an d th en decode an d
accom plish th em th r ou gh in ter pr etation

Par se Tr ees I n t er m edi at e Code


Par se T r ees I n t er m edi at e Code
I n t er m edi at e
Code I n t er pr et er Resu l t s
Gen er at or I n t er m edi at e
Code I n t er pr et er Resu l t s
Gen er at or

[Hybrid Implementation Systems, Page 12 of 12]

Introduction to Programming Languages * Property of STI


Page 12 of 12

EVALUATION/GENERALIZATION:

o Imperative languages, also called algorithmic languages, are


probably the most prevalent among the programming language
paradigms today.
o Declarative languages are those based on relations or functions.
o The two primary components of a computer are its processor
and its internal memory.
o The stages of compilation are analysis and synthesis.
o Pure interpretation is a method of software simulation, which
translates high-level language programs by interpreting them
through software simulation of a computer whose machine
language is the high-level language itself.
o Ask the students to write an evaluation of some programming
languages they know using the criteria described in the course
topic.

REFERENCE:

 Sebesta, Robert W., 2004, Concepts of programming languages (6


th

ed)

Introduction to Programming Languages *Property of STI


Page 7 of 7

You might also like