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

Module 1 - Background Concepts Lecture Notes

This document discusses programming languages. It begins by defining a programming language and outlining the objectives of studying programming languages. It then provides examples of "Hello World" programs in various languages. It discusses reasons for studying programming languages and how they evolved from 1950-1970 and 1971-1990. It also covers criteria for evaluating languages and ways of classifying languages by levels of abstraction, generations, and programming paradigms.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Module 1 - Background Concepts Lecture Notes

This document discusses programming languages. It begins by defining a programming language and outlining the objectives of studying programming languages. It then provides examples of "Hello World" programs in various languages. It discusses reasons for studying programming languages and how they evolved from 1950-1970 and 1971-1990. It also covers criteria for evaluating languages and ways of classifying languages by levels of abstraction, generations, and programming paradigms.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

[1] Background

Concepts
IS 214 - Principles of Programming Languages - 1st Sem AY
2020-2021
Objectives

At the end of this chapter, you should be able to:

● Define a programming language.


● Trace the history of programming languages.
● Classify programming languages according to different classification types.

2
What is a Programming Language?

● System for describing computation.


● System of signs to communicate a task/algorithm to a computer,
causing the task to be performed.

https://files.virgool.io/upload/users/8875/posts/mrh9yu1k0r
wf/kp0gsnfhzmp7.jpeg
3
Hello World in Assembly
dosseg
.model small
.stack 100h
.data
hello_message db 'Hello, World!',0dh,0ah,'$’

.code
main proc
mov ax,@data
mov ds,ax

mov ah,9
mov dx, offset hello_message
int 21h

mov ax,4C00h
int 21h
main endp
end main 4
Hello World in COBOL

IDENTIFICATION DIVISION.
PROGRAM-ID. Hello.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
Display 'Hello, World'.
STOP RUN.

5
Hello World in Java and Python

Java: Python:
public class Hello print("Hello World")
{
public static void main(String args[])
{
System.out.println("Hello World");
}
}

6
Hello World in Scheme and LOLCODE

Scheme: LOLCODE:

(define hello-world HAI


(lambda () CAN HAS STDIO?
(writes ‘nil “Hello, World!”))) VISIBLE “HAI WORLD!”
KTHXBYE

7
Hello World in brainf*ck

/e+++++++++++++++++++++++++++++.\
./\/\/\ /+++\!>.+++o.l.+++++++l/
#/?\

$H!\++++++\ + \comma.------------
.<w++++++++.\ /?\<!\-/
/++++++/ +/\ /.--------o/ \-
/!.++++++++++/?\n
/=\++++++\ +\\!=++++++\
.d--------.>+.!\-/ \r+++.l------
\!\/\/\/\/ \++++++++++/

8
Reasons for Studying PL’s

1. To improve ability to develop algorithms.


2. To improve use of existing programming languages.
3. To increase your vocabulary of useful programming constructs.
4. To allow a better choice of a programming language.
5. To make it easier to learn a new programming language.

9
Programming Languages
1950-1970
● Numerically-based languages
● Business languages
● Artificial intelligence languages
● System languages

10
Numerically-based Languages

Examples:

• FORTRAN (FORmula TRANslation)


➔ 1st successful PL.
➔ Designed specifically for scientific &
engineering applications.
➔ FORTRAN-I: Considered a milestone in the
history of computing.

• ALGOL-60 (ALGOrithmic Language)


➔ Aimed to improve FORTRAN
➔ Became the basis of almost all
block-structured language.

11
Business Languages

Examples:

• COBOL (COmmon Business Oriented


Language)
➔ A fabulous language.
➔ Heavily supported by the US government.
➔ Heavily structured data definitions that
looks like the English language.
➔ Self-documenting.

12
Artificial Intelligence Languages

Examples:

• LISP
➔ First major language to support list
processing.
➔ First major language to support recursion.
➔ First functional language.

13
Systems Languages

14
Programming Languages
1971-1990

15
Programming Languages (1971-1990)

16
Programming Languages (1971-1990)

17
Ancestry Chart

18
Programming Domains

● Scientific applications
● Business application
● Artificial intelligence
● Systems programming
● Scripting languages
● Special-purpose languages

19
Language Evaluation
Criteria

20
Language Evaluation Criteria

1. Readability
○ Is it easy to read and understand a program or a portion of it in a written in the
language?
2. Writability
○ Is it easy to write programs in the language?
3. Reliability
○ Does the program help prevent errors?
4. Cost
○ How expensive is it to develop, use, and maintain programs written in the
language?
21
Readability Factors

● Overall simplicity
○ Too many features are bad
○ Multiplicity of features is bad
● Orthogonality
○ A relatively small set of primitive constructs can be combined in a relatively small
number of ways to build the control and data structures of the language
○ Makes the language easy to learn and read.
○ Meaning is context independent.
○ Every possible combination is legal.
○ Lack of orthogonality leads to exception to rules.
22
Readability Factors

● Control statements
● Defining data types and structures
● Syntax considerations
○ Identifier forms
○ Special words
○ Form and meaning

23
Writability Factors

● Simplicity and orthogonality


● Support for abstraction
● Expressivity

24
Reliability Factors

● Type checking
● Exception handling
● Aliasing
● Readability and writability

25
Cost Factors

● Training programmers to use language


● Writing programs
● Compiling programs
● Executing programs
● Language implementation system
● Reliability
● Maintaining programs

26
● When writability is enhanced,
readability suffers.
● When the program helps prevent
errors, what does that mean?

27
Classifying Programming
Languages

28
Classifying PL’s according to...

1. Levels of abstraction
2. Generations
3. Programming paradigms
4. Methods of implementation

29
1. Levels of Abstraction

Characteristics Low Level High Level Very High Level


Instructions Simple machine-like Expressions and Fully abstract
explicit flow of machine
control

Memory Handling Direct memory Memory access and Fully hidden memory
access and allocation allocation through access and
operations automatic allocation

Examples Machine, Assembly C, Java Logo


30
2. Generations

(1) FIRST GENERATION (2) SECOND GENERATION


(early 1960’s)

low-level machine language, ALGOL-60, BASIC, COBOL,


assembly language FORTRAN

(3) THIRD GENERATION (4) FOURTH GENERATION


(late 1960’s to present) (domain specific languages)

Pascal, C, ADA, Java, Eiffel VB, SQL, Access, Excel

31
3. Programming Paradigms

1. Imperative
○ “How is it to be achieved”
○ To solve a problem, we specify the step-by-step procedure.
○ Central features are variables, assignment statements, and iteration.

a. Block-structured
■ The procedure is the principal building block of the program
■ Represented by stack
■ Examples: Pascal, C
b. Object-oriented
■ Languages that employ objects.
■ An object is a group of procedures that share a state.
■ Examples: Java, Modula
32
3. Programming Paradigms

2. Declarative
○ “What is to be achieved”
○ Program requires specification of a relation or function.
○ Mainly based on math concepts on logic, theory on functions and relational calculus.

a. Logic
■ Based on a subset of predicate calculus.
■ Axioms and rules are used to deduce new facts.
■ Example: Prolog
b. Functional
■ Operate only through functions that return one value given a list of parameters
■ Example: LISP

33
4. Methods of Implementation

1. Compilation - method where a high level language is translated into another implemented language.
Approaches:

1. High-level language → machine language


2. High-level language → assembly language → machine language
3. High-level language → intermediate language → assembly or machine language

2. Interpretation - the instruction in the high level language is executed directly

34
● Why were programming
languages born?
● Why are there so many
programming languages out
there?

35

You might also like