WK 1 Ses 1-2 Introduction To Programming Languages
WK 1 Ses 1-2 Introduction To Programming Languages
Specific Objectives:
At the end of the topic session, the students are expected to:
Cognitive:
Affective:
Psychomotor:
MATERIALS/EQUIPMENT:
o Topic slides
o OHP
TOPIC PREPARATION:
TOPIC PRESENTATION:
This will be the suggested flow of discussion for the course topic:
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.
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.
Page 5 of 12 Reliability
This refers to the ability of a program to perform its specifications under
Programming Languages
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
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
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]
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
Compilation Compilation
Page 10 of 12
Compilation or translation translates high-level language programs into
Programming Languages
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
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]
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
EVALUATION/GENERALIZATION:
REFERENCE:
ed)