C
o
e.
on
nZ
Dr. Nguyen Hua Phung
09, 2015
hV
ie
HCMC University of Technology, Viet Nam
in
m
Introduction
/>Dr. Nguyen Hua Phung
Introduction
1 / 26
C
o
Introduction
2
Reasons to study Concepts of Programming
Languages
3
Language Evaluation Criteria
4
Language Design
on
nZ
ie
hV
5
e.
1
Implementation Methods
in
m
Outline
/>Dr. Nguyen Hua Phung
Introduction
2 / 26
C
o
e.
hV
ie
nZ
on
My name: Nguyen Hua Phung
Email:
Website: />Office hour: 15:00-16:30 Thursday (subject to
change)
Sakai:
in
m
Lecturer In Charge
/>Dr. Nguyen Hua Phung
Introduction
4 / 26
C
o
e.
hV
ie
nZ
on
Programming Languages: Principles And Paradigms,
Maurizio Gabbrielli and Simone Martini, Springer,
2006.
Programming Languages: Principles and Practices,
Kenneth C. Louden, Thomson Brooks/Cole, 2003.
Ngon Ngu Lap Trinh: Cac nguyen ly va mo hinh, Cao
Hoang Tru, 2004.
in
m
References
/>Dr. Nguyen Hua Phung
Introduction
5 / 26
C
o
e.
on
hV
ie
nZ
Tutorial/Lab/Online: 15%
Assignment: 25%
Final: 60%
in
m
Assessment
/>Dr. Nguyen Hua Phung
Introduction
6 / 26
C
o
e.
hV
ie
nZ
on
After complete this subject, students are able to:
describe formally lexicon and grammar of a
programming language
describe and explain some mechanism of a
programming language
implement a interpreter/compiler for a simple
programming language
in
m
Objectives
/>Dr. Nguyen Hua Phung
Introduction
8 / 26
C
o
e.
hV
ie
nZ
on
Increased capacity to express idea
Improved background for choosing appropriate
languages
Increased ability to learn new languages
Better understanding of the significance of
implementation
Better use of languages that are already known
Overall advancement of computing
in
m
Benefits of Studying
/>Dr. Nguyen Hua Phung
Introduction
9 / 26
C
o
e.
hV
ie
nZ
on
Scientific Applications
Fortran, ALGOL 60
Business Applications
COBOL
Artificial Intelligence
LISP, Prolog
Systems Programming
PL/S, BLISS, Extended ALGOL, and C
Web Software
XHTML, JavaScript, PHP
in
m
Programming Domains
/>Dr. Nguyen Hua Phung
Introduction
11 / 26
C
o
e.
on
hV
ie
nZ
Simplicity
Orthogonality
Support of abstraction (Control, Data)
Safety
...
in
m
Language Characteristics
/>Dr. Nguyen Hua Phung
Introduction
12 / 26
C
o
e.
on
nZ
hV
ie
Readability
Writability
Reliability
Cost
in
m
Evaluation
/>Dr. Nguyen Hua Phung
Introduction
13 / 26
Von Neumann
C
o
e.
Computer Architecture
Imperative
on
Programming Methodologies
nZ
Machine-based
Procedural
Declarative
hV
ie
Logic
Functional
Constraint
Query-based
Object-Oriented
...
in
m
Influences on Language Design
/>Dr. Nguyen Hua Phung
Introduction
15 / 26
C
o
e.
on
Well-known computer architecture: Von Neumann
Imperative languages, most dominant, because of
von Neumann computers
hV
ie
nZ
Data and programs stored in memory
Memory is separate from CPU
Instructions and data are piped from memory to CPU
Basis for imperative languages
Variables model memory cells
Assignment statements model writing to memory cell
Iteration is efficient
in
m
Computer Architecture Influence
/>Dr. Nguyen Hua Phung
Introduction
16 / 26
C
o
e.
on
1950s and early 1960s: Simple applications; worry
about machine efficiency
Late 1960s: Efficiency became important; readability,
better control structures
nZ
Structured programming
Top-down design and step-wise refinement
Late 1970s: Process-oriented to data-oriented
ie
data abstraction
hV
Middle 1980s: Object-oriented programming
Data abstraction + inheritance + polymorphism
in
m
Programming Methodologies Influences
/>Dr. Nguyen Hua Phung
Introduction
17 / 26
C
o
Imperative (C, Pascal)
e.
Central features are variables, assignment
statements, and iteration
on
Functional (LISP, Scheme, Haskel, Ocaml, Scala)
nZ
Main means of making computations is by applying
functions to given parameters
Logic (Prolog)
Rule-based (rules are specified in no particular order)
ie
Object-oriented (Java, C++, Scala)
hV
Data abstraction, inheritance, late binding
Markup (XHTML, XML)
New; not a programming per se, but used to specify
the layout of information in Web documents
in
m
Language Paradigms
/>Dr. Nguyen Hua Phung
Introduction
18 / 26
C
o
Reliability vs. cost of execution
on
e.
Conflicting criteria
Example: Java demands all references to array
elements be checked for proper indexing but that
leads to increased execution costs
Readability vs. writability
ie
nZ
Another conflicting criteria
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
hV
Writability (flexibility) vs. reliability
in
m
Language Design Trade-Offs
Another conflicting criteria
Example: C++ pointers are powerful and very flexible
but not reliably used
/>Dr. Nguyen Hua Phung
Introduction
19 / 26
C
o
hV
ie
nZ
on
e.
Compilation
Programs are entirely translated into machine
language and then executed
Pure Interpretation
Programs are translated and executed line-by-line
Hybrid Implementation Systems
A compromise between compilers and pure
interpreters
Just-in-time Compiler
A compiler inside an interpreter compiles just hot
methods
in
m
Implementation Methods
/>Dr. Nguyen Hua Phung
Introduction
21 / 26
C
o
e.
Compiler
Source
Execution
Result
on
Data
nZ
Source
Interpreter
hV
Source
Result
ie
Data
in
m
Implementation Methods
Compiler
Interpreter
Result
Data
/>Dr. Nguyen Hua Phung
Introduction
22 / 26
C
o
on
lexical analyzer
e.
source program
syntax analyzer
front end
nZ
semantic analyzer
ie
intermediate code generator
code optimizer
hV
back end
code generator
target program
in
m
Compilation Phases
/>Dr. Nguyen Hua Phung
Introduction
24 / 26
C
o
e.
on
hV
ie
nZ
Preprocessor
Assembler
Linker
Loader
Debugger
Editor
in
m
Related Programs
/>Dr. Nguyen Hua Phung
Introduction
25 / 26
C
o
e.
on
hV
ie
nZ
What are still in your mind?
in
m
Summary
/>Dr. Nguyen Hua Phung
Introduction
26 / 26