Upload
dangnhi
View
213
Download
1
Embed Size (px)
Citation preview
Pro
gra
mm
ing
La
ng
ua
ges
(CS
234319
)
Dr. T
al Co
hen
Dr. T
al Co
hen
Go
og
le Israel En
gin
eering
Cen
ter
Win
ter 20
09
-20
10
Ba
sed o
n slid
es by P
rof. R
on
Pin
ter, C
S d
ept., T
echn
ion
Ad
min
istra
tion
�T
his
is n
ot a
n in
tern
et c
ou
rse
! Mo
st m
ate
rial is
pro
vid
ed
in c
lass a
nd
tu
toria
ls.
�S
om
e m
ate
rial a
va
ilab
le o
n th
e w
eb
-http://webcourse.cs.technion.ac.il/234319
�O
fficia
l po
licy w
ill be
pu
blis
he
d a
t the
ab
ove
site
�P
rere
qu
isite
s a
nd
co
-req
uis
ites a
re s
trictly
en
forc
ed
�R
un
nin
g a
nn
ou
nce
me
nts
will b
e s
en
t thro
ug
h th
e c
ou
rse
ma
iling
list; p
lea
se
su
bscrib
e fro
m th
e c
ou
rse
’s w
eb
pa
ge
�R
eq
ue
sts
an
d q
ue
stio
ns:
Intro
du
ctio
n-2
�R
eq
ue
sts
an
d q
ue
stio
�C
ou
rse
sta
ff�
Dr. T
al C
ohen, ctal@cs
Offic
e h
ours
:by a
ppoin
tment o
nly
.
�M
r. Yuval S
him
ron (h
ead T
A)
�M
r. Ido B
en Z
vi
As
sig
nm
en
ts a
nd
Gra
din
g�
Assig
nm
ents
:
�E
ve
ry 1
-2 w
ee
ks
�T
ota
l we
igh
t is u
p to
20
% (n
ot o
ptio
na
l)
�T
ea
ms
of 2
(stric
t!) -m
atc
hin
g s
erv
ice
s p
rovid
ed
by te
ac
hin
g
as
sis
tan
ts
�F
inal e
xam
:
�D
ate
(s) s
et b
y th
e a
uth
oritie
s
Intro
du
ctio
n-3
�D
ate
(s) s
et b
y th
e a
uth
oritie
s
�W
eig
ht is
80
% o
r mo
re
�F
inal G
rade:
�If e
xa
m >
50
the
n 0
.8*e
xa
m +
0.2
*as
sig
nm
en
ts
�E
lse
1.0
*ex
amW
hy
No
tS
tud
yP
rog
ram
min
g L
an
gu
ag
es
?
�T
he e
xpre
ssiv
e p
ow
er
of a
ll pro
gra
mm
ing m
echanis
ms
and c
om
puta
tional d
evic
es is
basic
ally
the s
am
e [th
e C
hu
rch
-T
urin
g H
yp
oth
esis
]:
�T
he
DO
S b
atc
h la
ng
ua
ge
an
d J
ava
are
eq
uiv
ale
nt
�T
he
Co
mm
od
ore
64
an
d th
e la
test 8
-co
re C
PU
s a
re e
qu
iva
len
t
�N
oth
eore
ms, p
roofs
, lem
mas, o
r inte
gra
tion b
y p
arts
Intro
du
ctio
n-4
�N
oth
eore
ms, p
roofs
, lem
mas, o
r inte
gra
tion b
y p
arts
�N
o e
asy g
rade
�It’s
at 8
:30 A
M –
even th
e le
ctu
rer is
still a
sle
ep.
Wh
y S
tud
y P
rog
ram
min
g L
an
gu
ag
es
?
�E
valu
atio
n o
f a la
ng
uag
e’s
featu
res a
nd
usefu
lness
�T
he
exp
ressiv
e p
ow
er
of p
rog
ram
min
g la
ng
ua
ge
sis
no
tth
e s
am
e
�O
ve
r 2,0
00
diffe
ren
t lan
gu
ag
es o
ut th
ere
�C
om
mo
n c
on
ce
pts
an
d s
ha
red
pa
rad
igm
s
�F
ram
ew
ork
for c
om
pa
rativ
e s
tud
ies
�B
ecause it’s
fun
�M
L is
ne
at
Intro
du
ctio
n-5
�P
rolo
g is
ele
ga
nt
�T
he
re is
mo
re to
it tha
n C
, C+
+, J
ava
�T
he
ore
tica
l pa
rt will g
ive
yo
u a
ne
w w
ay o
f se
ein
g th
ing
s y
ou
th
ou
gh
t yo
u k
ne
w
�W
ill pro
ve u
sefu
l for o
ther c
ours
es:
�O
OP
�C
om
pila
tion
�S
oftw
are
En
gin
ee
ring
�S
em
an
tics o
f Pro
gra
mm
ing
La
ng
ua
ge
s
Pro
ble
m...
�T
o te
ach y
ou p
rogra
mm
ing la
nguage th
eory
, we n
eed to
dra
w e
xam
ple
s fro
m d
iffere
nt p
rogra
mm
ing la
nguages.
�R
ight n
ow
, most o
f you k
now
~2.5
languages (C
, C+
+, U
nix
shell s
crip
ts).
�E
xam
ple
s in
these s
lides c
om
e fro
m (a
lphabetic
ally
): Ad
a,
Alg
ol, A
WK
, C, C
++
, C#, E
iffel, F
OR
TR
AN
, Haskell,
Java, M
L, L
azy M
L, L
ISP
, Pascal, P
rolo
g, P
yth
on
, SQ
L,
Intro
du
ctio
n-6
Java, M
L, L
azy M
L, L
ISP
, Pascal, P
rolo
g, P
yth
on
, SQ
L,
and p
robably
a fe
w m
ore
I forg
ot.
�C
an y
ou p
lease le
arn
all th
ese fo
r next w
eek?
�R
ecita
tions a
re h
ere
to h
elp
.
Wh
o N
ee
ds
Pro
gra
mm
ing
La
ng
ua
ge
s?
�C
om
pute
rs' n
ativ
e to
ngue is
machin
e la
nguage
�P
rogra
mm
ers
need h
igher le
vel la
nguages, b
ecause:
�T
he
y c
an
't write
ma
ch
ine
lan
gu
ag
e c
orre
ctly
�T
he
y c
an
't rea
d m
ach
ine
lan
gu
ag
e flu
en
tly
�T
he
y c
an
't exp
ress th
eir id
ea
s in
ma
ch
ine
lan
gu
ag
e e
fficie
ntly
�L
ife is
too
sh
ort to
pro
gra
m in
ma
ch
ine
lan
gu
ag
e.
�A
form
al la
nguage is
not o
nly
a m
an-m
achin
e in
terfa
ce
Intro
du
ctio
n-7
�A
form
al la
nguage is
not o
nly
a m
an-m
achin
e in
terfa
ce
but a
lso a
pers
on-to
-pers
on la
nguage!
Co
nclu
sio
n: P
rogra
mm
ing la
nguages a
re a
com
pro
mis
e
betw
een th
e n
eeds o
f hum
ans a
nd th
e n
eeds o
f machin
es
�A
linguis
tic to
ol w
ith fo
rmalsynta
x a
nd s
em
antic
s
�A
conscio
usly
desig
ned a
rtifactth
at c
an b
e im
ple
mente
d
on c
om
pute
rs
�“A
conceptu
al u
niv
ers
e fo
r thin
kin
g a
bout p
rogra
mm
ing”
(Ala
n P
erlis
, 1969)
Wh
at is
a P
rog
ram
min
g L
an
gu
ag
e?
Intro
du
ctio
n-8
Wh
at L
an
gu
ag
es
do
I Us
e a
t Wo
rk?
�R
eg
ula
rly:
�C
++
,
�B
ash
scrip
ts,
�S
aw
za
ll,
�Ja
va
,
�L
1[d
ata
ce
nte
r co
ntro
l lan
gu
ag
e]
�O
ccasio
nally
:
Intro
du
ctio
n-9
�O
ccasio
nally
:
�S
QL
,
�P
yth
on
,
�Ja
va
Scrip
t,
�L
2[d
ata
ce
nte
r mo
nito
ring
lan
gu
ag
e]
Are
n’t A
ll La
ng
ua
ge
s P
retty
Mu
ch
the
S
am
e?
�T
he m
ove fro
m C
to C
++
isn’t in
surm
ounta
ble
.
�M
ovin
g fro
m C
++
to J
ava is
trivia
l.
�A
nd if y
ou k
now
Java, y
ou p
retty
much k
now
C#, to
o.
�E
ven if th
e s
ynta
x is
n’t C
-sty
le u
sed (e
.g., E
iffel), it c
an’t b
e
that d
ifficult, rig
ht?
Intro
du
ctio
n-1
0
that d
ifficult, rig
ht?
�W
hy m
ake s
uch
a fu
ss a
bo
ut it?
SQ
L: W
ha
t’s th
e D
iffere
nc
e?
SE
LE
CT
first_
nam
e, la
st_
nam
e, a
ge
FR
OM
user
WH
ER
E firs
t_nam
e =
“David
”
OR
DE
R B
Y a
ge
vs.
Intro
du
ctio
n-1
1
vs.
SE
LE
CT
first_
nam
e, la
st_
nam
e, a
ge
FR
OM
user
WH
ER
E a
ge >
18 A
ND
age <
65
OR
DE
R B
Y a
ge
Th
ink a
bo
ut
imp
lemen
ting
these
qu
eries in C
++
. Wo
uld
th
e cod
e loo
k just th
e sa
me in
bo
th ca
ses?
Wh
at is
a P
ara
dig
m?
�p
ar·a
·dig
m(M
erria
m-W
ebste
r Colle
gia
te D
ictio
nary
)
�“a
ph
iloso
ph
ica
l an
d th
eo
retic
al fra
me
wo
rk o
f a s
cie
ntific
sch
oo
lo
r dis
cip
line
with
in w
hic
h th
eo
ries, la
ws, a
nd
ge
ne
raliz
atio
ns
an
d th
e e
xp
erim
en
ts p
erfo
rme
d in
su
pp
ort o
f the
m a
re fo
rmu
late
d”
�M
od
el, p
atte
rn
�T
ho
mas K
uh
n (1
922-1
996)
�A
se
t of “u
niv
ers
ally
” reco
gn
ize
d s
cie
ntific
ach
ieve
me
nts
tha
t
Intro
du
ctio
n-1
2
�A
se
t of “u
niv
ers
ally
” reco
gn
ize
d s
cie
ntific
ach
ieve
me
nts
tha
tfo
r a tim
e p
rovid
e a
mo
de
l for a
co
mm
un
ity p
ractitio
ne
rs.
�T
he S
apir-W
horf h
ypoth
esis
: The la
nguage s
poken
influ
ences th
e w
ay re
ality
is p
erc
eiv
ed.
�P
S: M
ost m
od
ern
(na
tura
l) ling
uis
ts c
on
sid
er th
is to
be
BS
.
�In
pro
gra
mm
ing la
nguages: a
fam
ily o
f languages w
ith
sim
ilar b
asic
constru
cts
and “m
enta
l model” o
f executio
n
Pro
gra
mm
ing
La
ng
ua
ge
Pa
rad
igm
s
�(N
ot c
om
pre
hensiv
e)
�(N
ot to
scale
)
Pro
cedu
ral
Ob
ject-Orien
ted
C
C+
+
Pa
scal
Imp
erative
Intro
du
ctio
n-1
3
Pro
cedu
ral
Ob
ject-Orien
ted
Fu
nctio
na
l
Decla
rative
C+
+
Ja
va
Eiffel
SQ
L
ML
Lisp
CL
OS
ba
sh
Lo
gic
Pro
log
Da
talo
g
Pro
gra
mm
ing
Lin
gu
istic
s
�S
imila
r to n
atu
ral lin
guis
tics
�S
yn
tax =
Fo
rm
�S
em
an
tics =
Me
an
ing
�N
atu
ral la
nguages
�sp
an
mu
ch
gre
ate
r ran
ge
�a
re m
ore
exp
ressiv
e
Intro
du
ctio
n-1
4
�a
re m
ore
su
btle
�D
iscip
line
�N
atu
ral la
ng
ua
ge
s: w
ha
t’s in
exis
ting
lan
gu
ag
es
�P
rog
ram
min
g la
ng
ua
ge
s: b
ette
r wa
ys to
de
sig
n la
ng
ua
ge
s
Pro
gra
mm
ing
La
ng
ua
ge
Te
rmin
olo
gy
�W
hat k
ind
of a
beast is
JavaS
crip
t?
�Im
pera
tive,
�W
ith p
roto
typ
es
(obje
ct-b
ased, b
ut n
ot o
bje
ct-o
riente
d),
�F
unctio
ns a
re firs
t-cla
ss e
ntitie
s,
�H
as la
mb
da fu
nctio
ns,
�W
ith c
losu
res,
By th
e end
of th
ese co
urse, m
ost o
f
Intro
du
ctio
n-1
5
�W
ith c
losu
res,
�Is
weakly
typ
ed
,
�H
as d
yn
am
ic ty
pin
g,
�H
as d
yn
am
ic s
co
pin
g,
�…
and a
must-k
now
for a
ny m
odern
website
develo
per!
cou
rse, mo
st of
these term
s will b
e co
vered in
dep
th.
Sy
nta
x a
nd
Se
ma
ntic
s
�E
very
pro
gra
mm
ing la
nguage h
as:
�S
yn
tax: T
he fo
rmof p
rogra
ms. H
ow
expre
ssio
ns,
com
mands, d
ecla
ratio
ns a
re p
ut to
geth
er to
form
a
pro
gra
m:
�R
eg
ula
r exp
ressio
ns
�C
on
text-fre
e g
ram
ma
rs: B
NF
form
, syn
tax c
ha
rts
�“F
orm
al L
an
gu
ag
es” c
ou
rse
Intro
du
ctio
n-1
6
�“F
orm
al L
an
gu
ag
es” c
ou
rse
�S
em
an
tics: T
he m
eanin
gof p
rogra
ms
�H
ow
do
the
y b
eh
ave
wh
en
exe
cu
ted
on
a c
om
pu
ter?
�C
an h
ave “th
e s
am
e” s
em
antic
concept w
ritten w
ith
diffe
rent s
ynta
x in
diffe
rent la
nguages, o
r sem
antic
ally
diffe
rent c
oncepts
that u
se th
e s
am
e s
ynta
x! (c
onsid
er =
)
�U
niv
ers
al: e
ve
ry p
rob
lem
mu
st h
ave
a s
olu
tion
�E
xpre
ss re
curs
ive fu
nctio
ns
�E
xceptio
n: d
om
ain
-specific
languages
�N
o re
cu
rsio
n in
sta
nd
ard
SQ
L.
�N
atu
ral: a
pp
lica
tion
do
ma
in s
pe
cific
�T
ry w
riting
a c
om
pile
r in C
ob
ol o
r a G
UI in
FO
RT
RA
N
Req
uire
men
ts fro
m a
Pro
gra
mm
ing
Lan
gu
ag
e
Intro
du
ctio
n-1
7
�T
ry w
riting
a c
om
pile
r in C
ob
ol o
r a G
UI in
FO
RT
RA
N
�Im
ple
me
nta
ble
:�
Neith
er m
ath
em
atic
al n
ota
tion
�N
or n
atu
ral la
nguage
�E
fficie
nt: o
pe
n to
de
ba
te�
More
pro
gra
mm
ing c
rimes w
ere
com
mitte
d in
the n
am
e
of p
erfo
rmance th
an fo
r any o
ther re
ason.
De
sid
era
ta fo
r a P
rog
ram
min
g L
an
gu
ag
e
�E
xp
ressiv
en
ess
�T
urin
g-c
om
ple
ten
ess
�B
ut a
lso a
pra
ctic
al k
ind o
f expre
ssiv
eness: h
ow
easy
is it to
pro
gra
m s
imple
concepts
?
�E
fficie
ncy
�R
ecurs
ion in
functio
nal la
nguages is
expre
ssiv
e b
ut In
trod
uctio
n-1
8
�R
ecurs
ion in
functio
nal la
nguages is
expre
ssiv
e b
ut
som
etim
es in
effic
ient
�Is
there
an e
fficie
nt w
ay to
imple
ment th
e la
nguage
(in m
achin
e c
ode)?
De
sid
era
ta fo
r Pro
gra
mm
ing
La
ng
ua
ge
s
(co
nt’d
)
�S
imp
licity
-as fe
w b
asic
concepts
as p
ossib
le�
So
me
time
s a
trad
e-o
ff with
co
nve
nie
nce
(C h
as “fo
r”, wh
o n
ee
ds
“wh
ile” a
nd
“do
-wh
ile”?
)
�U
nifo
rmity
and c
onsis
tency o
f concepts
�W
hy d
oe
s fo
r in P
asca
l req
uire
a s
ing
le s
tate
me
nt w
hile
rep
ea
t a
llow
s a
ny n
um
be
r of s
tate
me
nts
?
Intro
du
ctio
n-1
9
�A
bstra
ctio
n-
language s
hould
allo
w to
facto
r out re
currin
g
patte
rns
�C
larity
to h
um
ans
�T
he
dis
tinctio
n=
vs.=
= in
C is
a b
it co
nfu
sin
g
�In
form
atio
n h
idin
gand m
od
ula
rity
�S
afe
ty-
possib
ility to
dete
ct e
rrors
at c
om
pile
time
�A
wk, R
EX
X a
nd
SN
OB
OL
typ
e c
on
ve
rsio
ns a
re e
rror p
ron
e
“L
es
s is
Mo
re”
�T
wo
pro
gra
m fra
gm
en
ts to
find
the
nth
Fib
on
ac
ci n
um
be
r in A
lgo
l 68
x,y := 1;
ton do(ifx<y thenx elsey) := x+y;
Intro
du
ctio
n-2
0
x := max(x,y);
x,y := 1;
ton dobeginx,y := y,x; x := x+y end;
Wh
y W
as
Ma
rine
r 1 A
bo
rted
?
An
ap
plic
atio
n p
rog
ram
writte
n in
FO
RT
RA
N:
DO 17 I=1.3
�B
ad
lexic
al d
efin
ition
–sp
ace
s a
re im
ma
teria
l
�N
o d
ecla
ratio
n o
f va
riab
les (x
2)
Intro
du
ctio
n-2
1
�N
o d
ecla
ratio
n o
f va
riab
les (x
2)
�Im
plic
it typ
ing
(x2
)
�B
ad
sco
pin
g ru
les
�P
oo
r co
ntro
l stru
ctu
re s
pe
cific
atio
n
�L
ack o
f dia
gn
ostic
s
�(P
rob
ab
ly n
ot th
e re
al c
au
se
. Sto
ry a
lso
told
ab
ou
t Ra
ng
er 3
.)
Wh
at C
ha
rac
teriz
es
a P
rog
ram
min
g L
an
gu
ag
e
0.
Fo
rma
l Syn
tax
an
d S
em
an
tics
1.
Co
nc
ep
ts�
How
it handle
s v
alu
es
=>
valu
es, ty
pes
an
d e
xp
ressio
ns
�H
ow
it checks ty
pes
=>
typ
ing
syste
msIn
trod
uctio
n-2
2
�H
ow
it checks ty
pes
=>
typ
ing
syste
ms
�Its
entitie
s fo
r sto
ring v
alu
es
=>
sto
rag
e
�Its
means fo
r sto
ring v
alu
es
=>
co
mm
an
ds
�H
ow
it manages c
ontro
l=
> s
eq
uen
cers
�H
ow
it atta
ches n
am
es to
valu
es
=>
bin
din
g
�H
ow
it allo
ws
genera
lizatio
n=
> a
bstra
ctio
n
2.
Para
dig
ms
�Im
pera
tive p
rogra
mm
ing:
�F
ortra
n, C
ob
ol, A
lgo
l, PL
/I, C, P
as
ca
l, Ad
a, C
++
, Ico
n,
Mo
du
la-2
, Mo
du
la-3
, Ob
ero
n, B
as
ic.
�C
oncurre
nt p
rogra
mm
ing:
Wh
at C
ha
rac
teriz
es
a P
rog
ram
min
g L
an
gu
ag
e (c
on
t’d)Intro
du
ctio
n-2
3
Concurre
nt p
rogra
mm
ing:
�A
da
, Oc
ca
m, P
ar-C
.
�O
bje
ct-o
riente
d p
rogra
mm
ing:
�S
ma
ll-talk
, Se
lf, C+
+, O
bje
ctiv
e-C
, Ob
jec
t Pa
sc
al, B
eta
, CL
OS
, E
iffel
�F
unctio
nal p
rogra
mm
ing:
�L
isp
, Sc
he
me
, Mira
nd
a, M
L.
�Logic
pro
gra
mm
ing:
�P
rolo
g, P
rolo
g-d
iale
cts
, Tu
rbo
-Pro
log
, Ico
n.
Th
e Im
pe
rativ
e P
ara
dig
m
�F
ortra
n, A
lgol, C
, Pascal, A
da…
�T
he p
rogra
m h
as a
sta
te re
flecte
d b
y s
tora
ge a
nd lo
catio
n
�It c
om
pris
es c
om
mands (a
ssig
nm
ents
, sequencers
, etc
.) th
at u
pdate
the s
tate
of th
e p
rogra
m�
Th
ey c
an
be
gro
up
ed
into
pro
ce
du
res a
nd
fun
ctio
ns
�T
here
are
als
o e
xpre
ssio
ns a
nd o
ther fu
nctio
nal fe
atu
resIntro
du
ctio
n-2
4
�T
here
are
als
o e
xpre
ssio
ns a
nd o
ther fu
nctio
nal fe
atu
res
�M
ost fa
milia
r, but a
larg
e v
arie
ty o
f possib
ilities m
ust b
e
maste
red a
nd u
nders
tood
�M
odels
real-w
orld
pro
cesses, h
ence s
till dom
inant
�Lends its
elf to
effic
ient p
rocessin
g (o
ptim
izin
g c
om
pile
rs
etc
.)
�W
ill see P
ascal in
recita
tions a
nd h
om
e a
ssig
nm
ent
Th
e F
un
ctio
na
l Pa
rad
igm
�Lis
p, S
chem
e, M
L, H
askell…
�E
very
thin
g is
a fu
nctio
n th
at ta
kes a
rgum
ents
and re
turn
s
results
�M
ore
over, th
e fu
nctio
ns a
re ju
st a
noth
er k
ind o
f valu
e th
at
can b
e c
om
pute
d (c
reate
d), p
assed a
s a
para
mete
r, etc
.
�D
on’t re
ally
need a
ssig
nm
ent o
pera
tion o
r sequencers
–can d
o e
very
thin
g a
s re
turn
ing a
result v
alu
e o
f com
putin
g
a fu
nctio
n
Intro
du
ctio
n-2
5
can d
o e
very
thin
g a
s re
turn
ing a
result v
alu
e o
f com
putin
g
a fu
nctio
n�
E.g
., use
recu
rsiv
e a
ctiv
atio
n o
f fun
ctio
ns in
ste
ad
of ite
ratio
n
�E
legant, e
xte
nsib
le, fe
w b
asic
concepts
�U
sed fo
r list m
anip
ula
tion, a
rtificia
l inte
lligence, …
�R
equire
s a
truly
diffe
rent p
erc
eptio
n –
usin
g a
n im
pera
tive
pro
gra
mm
ing s
tyle
in M
L is
even w
ors
e th
an a
word
-for-
word
transla
tion a
mong n
atu
ral la
nguages
�W
ill see M
L, m
ain
ly in
the re
cita
tions
Th
e L
og
ic P
rog
ram
min
g P
ara
dig
m
�P
rolo
g,constra
int la
nguages, d
ata
base q
uery
languages
�P
redic
ate
s a
s th
e b
asis
of e
xecutio
n
�F
acts
and ru
les a
re lis
ted n
atu
rally
�A
“com
puta
tion” is
implic
it–
it show
s w
hat fo
llow
s fro
m th
e
giv
en fa
cts
and ru
les
Intro
du
ctio
n-2
6
giv
en fa
cts
and ru
les
�E
mphasiz
es w
hat is
needed, ra
ther th
an h
ow
to c
om
pute
it
�U
sed fo
r “expert s
yste
ms”
�W
ill see th
e b
asic
s o
f Pro
log la
ter in
the c
ours
e
Th
e O
bje
ct-O
rien
ted
Pa
rad
igm
�C
++
, Sm
allta
lk, E
iffel, J
ava
�T
he w
orld
has o
bje
cts
that c
onta
in b
oth
field
s w
ith v
alu
es
and o
pera
tions (c
alle
d m
eth
ods) th
at m
anip
ula
te th
e v
alu
es
�O
bje
cts
com
munic
ate
by s
endin
g m
essages th
at a
sk th
e
obje
ct to
perfo
rm s
om
e m
eth
od o
n its
data
�T
ypes o
f obje
cts
are
decla
red u
sin
g c
lasses th
at c
an in
herit
the fie
lds a
nd m
eth
ods o
f oth
er c
lasses
Intro
du
ctio
n-2
7
the fie
lds a
nd m
eth
ods o
f oth
er c
lasses
�H
as b
ecom
e th
e p
rimary
para
dig
m b
ecause it s
eem
s to
tre
at la
rge s
yste
ms b
ette
r than o
ther a
ppro
aches
�T
reate
d m
ain
ly in
the fo
llow
-up c
ours
e “O
bje
ct-O
riente
d
Pro
gra
mm
ing” (2
36703)
�W
ill do a
little b
it of J
ava in
the re
cita
tions
Ex
ten
de
d B
ac
ku
s-N
au
r Fo
rm (E
BN
F)
�A
meta
-nota
tion fo
r describ
ing th
e g
ram
mar o
f a la
nguage
�T
erm
ina
ls =
actu
al le
ga
l strin
gs, w
ritten
as is
, or in
sid
e “+
”
�N
on
term
ina
ls =
co
nce
pts
of th
e la
ng
ua
ge
, writte
n ⟨p
rog
ram⟩
or p
rog
ram
or p
rog
ram
in d
iffere
nt v
aria
nts
�R
ule
s =
exp
an
din
g a
no
n-te
rmin
al to
a s
erie
s o
f NT
s a
nd
Ts
�O
ne n
onte
rmin
al is
desig
nate
d a
s th
e s
tart
of a
ny d
eriv
atio
n
�A
sequence o
f term
inals
not d
eriv
able
from
sta
rtsym
bol b
y
Intro
du
ctio
n-2
8
�A
sequence o
f term
inals
not d
eriv
able
from
sta
rtsym
bol b
y
rule
s o
f the g
ram
mar is
illega
l
�| is
choic
e a
mong s
evera
l possib
ilities
�[ ] e
nclo
se o
ptio
nal c
onstru
cts
�{ } e
nclo
ses z
ero
or m
ore
repetitio
ns
�E
xam
ple
: ⟨if-stm
t⟩=
if ⟨expre
ssio
n⟩
then ⟨s
tate
ment⟩
[ els
e ⟨s
tate
ment⟩
]
Ex
am
ple
of E
BN
F
�⟨e
xpre
ssio
n⟩
= ⟨te
rm⟩
{ ⟨add-o
p⟩⟨te
rm⟩
}
�⟨te
rm⟩
= ⟨fa
cto
r⟩{ ⟨m
ult-o
p⟩⟨fa
cto
r⟩}
�⟨fa
cto
r⟩=
⟨varia
ble
-nam
e⟩
| ⟨num
ber⟩
�⟨a
dd-o
p⟩
= +
| -
�⟨m
ult-o
p⟩
= ∗
| /
Intro
du
ctio
n-2
9
�Is
a +
2/ b
-c∗7 a
legal e
xpre
ssio
n?
�Y
es, b
ecause th
ere
is a
sequence o
f rule
applic
atio
ns fro
m
⟨expre
ssio
n⟩
that y
ield
s th
is s
tring (th
ese c
an b
e d
raw
n a
s
a “s
ynta
x tre
e” )
Ob
se
rva
tion
s o
n S
yn
tax
�If th
ere
are
severa
l possib
le s
ynta
x tre
es fo
r the s
am
e
sequence o
f term
inal s
ym
bols
, the s
equence is
synta
ctic
ally
am
big
uo
us, a
nd th
at o
ften le
ads to
sem
antic
am
big
uity
(severa
l possib
le w
ays to
unders
tand th
e
meanin
g)
�G
oo
d p
rog
ram
min
g la
ng
ua
ge
de
sig
n a
vo
ids
am
big
uity
�T
here
are
som
e s
ynta
ctic
rule
s th
at c
annot b
e e
xpre
ssed
just u
sin
g E
BN
F (w
hic
h g
ives c
onte
xt-fre
egra
mm
ars
)
Intro
du
ctio
n-3
0
just u
sin
g E
BN
F (w
hic
h g
ives c
onte
xt-fre
egra
mm
ars
)�
Eve
ry v
aria
ble
us
ed
is p
revio
us
ly d
ec
lare
d
�T
he
nu
mb
er o
f arg
um
en
ts in
a p
roc
ed
ure
ca
ll eq
ua
ls th
e
nu
mb
er o
f arg
um
en
ts in
the
de
cla
ratio
n o
f the
pro
ce
du
re
�M
uch m
ore
on g
ram
mars
and id
entify
ing le
gal p
rogra
ms
you w
ill learn
in th
e c
ours
es A
uto
mata
and F
orm
al
Languages
and C
om
pila
tion
�A
syste
m fo
r pro
cessin
g a
language:
�C
om
pile
r
�In
terp
rete
r
�S
yn
tax d
irecte
d e
dito
r
�P
rog
ram
ch
ecke
r
�P
rog
ram
ve
rifier
�S
tudie
d in
oth
er c
ours
es:
La
ng
ua
ge
Pro
ce
ss
ors
Intro
du
ctio
n-3
1
�S
tudie
d in
oth
er c
ours
es:
�C
om
pila
tion
�P
rog
ram
ve
rifica
tion
�S
oftw
are
en
gin
ee
ring
To k
now
the s
em
antic
s o
f a la
nguage (th
efu
nctio
na p
rogra
m
encodes) o
ne c
an ig
nore
its im
ple
menta
tion
Pro
gra
mm
ing
La
ng
ua
ge
sa
s S
oftw
are
To
ols
�In
genera
l pro
gra
mm
ing la
nguages a
re s
oftw
are
tools
-an
inte
rface b
etw
een h
um
an c
lients
and lo
wer-le
vel fa
cilitie
s
�O
ther s
oftw
are
tools
:
�In
tera
ctiv
e e
dito
rs
�D
ata
tran
sfo
rme
rs (c
om
pile
rs, a
sse
mb
lers
, ma
cro
pro
ce
sso
rs)
�O
pe
ratin
g s
yste
ms
Intro
du
ctio
n-3
2
�O
pe
ratin
g s
yste
ms
�T
oo
ls fo
r pro
gra
m m
ain
ten
an
ce
(scrip
t files, d
eb
ug
ge
rs)
�P
ropertie
s o
f pro
gra
mm
ing la
nguages a
s s
oftw
are
tools
:
�D
efin
ition
of th
e in
terfa
ce
= s
yn
tax a
nd
se
ma
ntic
s
�Im
ple
me
nta
tion
of th
e in
terfa
ce
to th
e lo
w le
ve
l facility
= c
om
pile
r
�U
se
fuln
ess fo
r the
hu
ma
n c
lien
t = e
va
lua
tion
of p
rog
ram
min
g
lan
gu
ag
es
Re
latio
ns
to O
the
r F
ield
s in
Co
mp
ute
r Sc
ien
ce
�D
ata
bases a
nd
Info
rmatio
n R
etrie
val:
Query
languages -
languages fo
r manip
ula
ting d
ata
bases.
�H
um
an
-Co
mp
ute
r Inte
ractio
n: P
rogra
mm
ing L
anguages
are
desig
ned to
be w
ritten a
nd re
ad b
y h
um
ans
Intro
du
ctio
n-3
3
�O
pera
ting
Syste
ms: In
put-O
utp
ut s
upport. S
tora
ge
managem
ent. S
hells
are
in fa
ct P
rogra
mm
ing L
anguages.
�C
om
pu
ter A
rch
itectu
re:
Pro
gra
mm
ing L
anguage d
esig
n is
in
fluenced b
y a
rchite
ctu
re a
nd v
ice v
ers
a. In
stru
ctio
ns s
ets
are
Pro
gra
mm
ing L
anguages. H
ard
ware
desig
n la
nguages.
Clo
se
ly R
ela
ted
To
pic
s
�A
uto
mata
an
d F
orm
al L
an
gu
ag
es, C
om
pu
tab
ility:
Pro
vid
e th
e fo
undatio
n fo
r much o
f the u
nderly
ing th
eory
.
�C
om
pila
tion
: The te
chnolo
gy o
f pro
cessin
g p
rogra
mm
ing
languages.
�S
oftw
are
en
gin
eerin
g: T
he p
rocess o
f build
ing s
oftw
are
syste
ms.
Intro
du
ctio
n-3
4
syste
ms.
�W
hat d
istin
guis
hes d
iffere
nt p
rogra
mm
ing la
nguages fro
m
one a
noth
er
�A
varie
ty o
f mechanis
ms in
fam
iliar a
nd le
ss fa
milia
r pro
gra
mm
ing la
nguages
�P
rogra
mm
ing in
the fu
nctio
nal la
nguage M
L
�S
om
e b
asic
concepts
from
Pascal, P
rolo
g a
nd o
thers
At th
e e
nd
of th
e c
ou
rse
yo
u’ll k
no
w
Intro
du
ctio
n-3
5
�T
wo
main
skills
:�
Ho
w to
learn
a n
ew
lan
gu
ag
e e
asily
�H
ow
to u
se la
ng
uag
es c
orre
ctly
�T
here
is n
oth
ing w
ors
e th
an w
riting J
avaS
crip
t code lik
e a
C p
rogra
mm
er.
Po
ss
ible
ap
pro
ac
he
s
�D
efin
e a
nd c
om
pare
para
dig
ms o
f pro
gra
mm
ing la
nguages
�P
resent fo
rmal a
ppro
aches to
synta
x a
nd s
em
antic
s
�P
resent w
ays o
f imple
mentin
g a
nd a
naly
zin
g p
rogra
ms in
vario
us p
rogra
mm
ing la
nguages
Intro
du
ctio
n-3
6
vario
us p
rogra
mm
ing la
nguages
�S
how
the c
oncepts
that m
ust b
e d
ealt w
ith b
y a
ny
pro
gra
mm
ing la
nguage, a
nd th
e p
ossib
le v
arie
ty in
tre
atm
ent
Sy
llab
us
�C
on
ce
pts
�va
lue
s, ty
pe
s a
nd
ex
pre
ss
ion
s
�ty
pin
g s
ys
tem
s
�s
tora
ge
�c
om
ma
nd
s
�s
eq
ue
nc
ers
�b
ind
ing
Intro
du
ctio
n-3
7
�a
bs
trac
tion
�P
ara
dig
ms
�e
nc
ap
su
latio
n
�fu
nc
tion
al p
rog
ram
min
g (M
L)
�lo
gic
pro
gra
mm
ing
(Pro
log
)
�A
bit o
f form
al s
em
an
tics
(as
time
pe
rmits
)
Co
urs
e T
op
ics
*)
1In
trod
uctio
n2
Valu
es
3S
tora
ge
4B
ind
ing
s
5A
bstra
ctio
n
6E
ncap
-su
latio
n
7T
yp
eS
yste
ms
8S
eq
uen
cers
9C
on
cu
rren
cy
Intro
du
ctio
n-3
8*) a
cco
rdin
g to
Wa
tt's b
oo
k c
ha
pte
rs
10
Imp
ara
tive
Para
dig
m
12
Ob
ject
Para
dig
m
13
Fu
nctio
nal
Para
dig
m
11
Co
ncu
rren
tP
ara
dig
m
14
Lo
gic
Para
dig
m
CP
ascal
ML
Pro
log
Te
xt B
oo
ks
�“P
rogra
mm
ing L
anguage C
oncepts
and P
ara
dig
ms”, b
y
David
A. W
att. P
rentic
e H
all, 1
990. C
hap
ters
1-8
,10,1
3-1
4.
�“A
dvanced P
rogra
mm
ing L
anguage D
esig
n”,
by R
aphael
Fin
kel. M
IT P
ress, 1
996. S
ele
cte
d m
ate
rial.
�“P
rogra
mm
ing L
anguages: C
oncepts
and C
onstru
cts
”(2
nd
Ed), b
y R
avi S
eth
i. Addis
on-W
esle
y, 1
996.
�“C
oncepts
in P
rogra
mm
ing L
anguages”, b
y J
ohn C
. Mitc
hell.
Intro
du
ctio
n-3
9
�“C
oncepts
in P
rogra
mm
ing L
anguages”, b
y J
ohn C
. Mitc
hell.
Cam
brid
ge U
niv
ers
ity P
ress, 2
002.
Bib
liog
rap
hy
for R
ec
itatio
ns
�“In
troductio
n to
Pascal”, b
y J
im W
els
h a
nd J
ohn E
lder.
Pre
ntic
e H
all, 1
979.
�“T
he J
ava P
rogra
mm
ing L
anguage”, b
y K
en A
rnold
et a
l, 3rd
editio
n o
r late
r.
�“M
L fo
r the W
ork
ing P
rogra
mm
er”, b
y L
aw
rence. C
. Pauls
on.
Cam
brid
ge U
niv
ers
ity P
ress, 1
991.
Intro
du
ctio
n-4
0
�“P
rolo
g P
rogra
mm
ing fo
r Artific
ial In
tellig
ence”, b
y Iv
an B
ratk
o.
Addis
on-W
esle
y.
�“P
rogra
mm
ing in
Pro
log”, b
y W
. F. C
locksin
and C
. S. M
ellis
h.
Sprin
ger-V
erla
g, 1
984.
�S
lides
La
ng
ua
ge
Inc
ep
tion
an
d E
vo
lutio
n
�In
itial d
efin
ition
by a
�sin
gle
pe
rso
n: L
isp
(McC
arth
y), A
PL
(Ive
rso
n), P
asca
l (Wirth
), R
EX
X (C
ow
lish
aw
), C+
+ (S
trou
stru
p), J
ava
(Go
slin
g)
�sm
all te
am
: C (K
ern
igh
an
an
d R
itch
ie), M
L (M
ilne
r et a
l.), P
rolo
g (C
locksin
an
d M
ellis
h), Ic
on
(Gris
wo
ld a
nd
Gris
wo
ld)
�co
mm
ittee
: FO
RT
RA
N, A
lgo
l, PL
/1, A
da
�S
om
e s
urv
ived
, man
y m
ore
peris
hed
Intro
du
ctio
n-4
1
�S
om
e s
urv
ived
, man
y m
ore
peris
hed
�u
sa
bility
�co
mp
ilatio
n fe
asib
ility
�d
ep
en
de
nce
on
pla
tform
�p
olitic
s a
nd
so
cio
log
y…
�M
ost s
uccessfu
l lan
gu
ag
es w
ere
taken
over
by a
sta
nd
ard
s’ c
om
mitte
es (A
NS
I, IEE
E, IS
O, …
)
�http
://ww
w.o
reilly
.com
/new
s/g
raphic
s/p
rog_la
ng
_p
oste
r.pdf
La
ng
ua
ge
Ge
ne
alo
gy
(till 19
90
)1950
1960
1970
Fo
rtran
Co
bo
l
PL
/I
Alg
ol-6
0
Alg
ol-6
8
Pascal
Sim
ula
Lis
pIntro
du
ctio
n-4
2
1980
1970
1990
Sm
allta
lk
Ad
a
CP
rolo
g
ML
Mira
nd
a
OO
lang.
Impera
tive a
nd
Concurre
nt la
ng.
Functio
nal la
ng.
C+
+
Haskell
His
toric
al B
ac
kg
rou
nd
�U
ntil e
arly
1950s: n
o re
al p
rogra
mm
ing la
nguages, b
ut
rath
er A
uto
matic
Pro
gra
mm
ing
, a m
ixtu
re o
f assem
bly
la
nguages a
nd o
ther a
ids fo
r machin
e c
ode p
rogra
mm
ing.
�M
ne
mo
nic
op
era
tion
co
de
s a
nd
sym
bo
lic a
dd
res
se
s
�S
ub
rou
tine
libra
ries
wh
ere
ad
dre
ss
es
of o
pe
ran
ds
we
re
ch
an
ge
d m
an
ua
lly
�In
terp
retiv
e s
ys
tem
s fo
r floa
ting
po
int a
nd
ind
ex
ing
�E
arly
1950s: th
e L
an
ing
an
d Z
ierle
rS
yste
m (M
IT):
Intro
du
ctio
n-4
3
�E
arly
1950s: th
e L
an
ing
an
d Z
ierle
rS
yste
m (M
IT):
a s
imple
alg
ebra
icla
nguage, a
libra
ry o
f usefu
l functio
ns.
�1954: D
efin
ition o
f FO
RT
RA
N(F
OR
mula
TR
AN
sla
tor).
Orig
inally
for n
um
eric
al c
om
putin
g.
�S
ym
bo
lic e
xp
ressio
ns, s
ub
pro
gra
ms w
ith p
ara
me
ters
, arra
ys, fo
rlo
op
s, if
sta
tem
en
ts, n
o b
locks, w
ea
k c
on
trol s
tructu
res
�1
95
7: firs
t wo
rkin
g c
om
pile
r
�E
arly
1960s:
�C
OB
OL
: Da
ta p
roce
ssin
g. M
ea
ns fo
r da
ta d
escrip
tion
.
�A
lgo
l 60
: Blo
cks, m
od
ern
co
ntro
l stru
ctu
res
�O
ne
of th
e m
ost in
flue
ntia
l imp
era
tive
lan
gu
ag
es
�G
ave
rise
to th
e A
lgo
l-like
lan
gu
ag
es fo
r two
de
ca
de
s (P
asca
l, P
L/1
, C, A
lgo
l 68
; Sim
ula
, Ad
a)
�L
isp
(list p
roce
ssin
g la
ng
ua
ge
): sym
bo
lic e
xp
ressio
ns (ra
the
r tha
n
His
toric
al B
ac
kg
rou
nd
(co
nt’d
)
Intro
du
ctio
n-4
4
�L
isp
(list p
roce
ssin
g la
ng
ua
ge
): sym
bo
lic e
xp
ressio
ns (ra
the
r tha
n
nu
me
rica
l), co
mp
uta
tion
by lis
t ma
nip
ula
tion
, ga
rba
ge
co
llectio
n;
the
first fu
nctio
na
l lan
gu
ag
e
�M
id 1
960s:
�P
L/1
: an
atte
mp
t to c
om
bin
e c
on
ce
pts
from
nu
me
rica
l co
mp
uta
tion
lan
gu
ag
es (F
OR
TR
AN
, Alg
ol 6
0) a
nd
da
ta
pro
ce
ssin
g la
ng
ua
ge
s (C
ob
ol).
�S
imu
la: o
bje
ct o
rien
ted
, ab
stra
ct d
ata
typ
es
�1970-1
990:
�S
eve
ral O
O la
ng
ua
ge
s: S
ma
lltalk
, C+
+, E
iffel
�L
og
ic P
rog
ram
min
g: P
rolo
g
�F
un
ctio
na
l Pro
gra
mm
ing
: ML
, Mira
nd
a, H
as
ke
ll
�A
da
:A
no
the
r atte
mp
t, mo
re s
ucce
ssfu
l tha
n P
L/I, fo
r a g
en
era
l p
urp
ose
lan
gu
ag
e, in
clu
din
g c
on
cu
rren
cy.
�S
pe
cific
usa
ge
s:
His
toric
al B
ac
kg
rou
nd
Intro
du
ctio
n-4
5
�S
pe
cific
usa
ge
s:
�S
NO
BO
L, Ic
on
, Aw
k, R
EX
X, P
erl: S
tring
ma
nip
ula
tion
an
d s
crip
ting
�S
QL
: Qu
ery
lan
gu
ag
e fo
r rela
tion
al d
ata
ba
se
s
�M
ath
em
atic
a, M
atla
b, P
yth
on
: Ma
the
ma
tica
l ap
plic
atio
ns
�...H
isto
rica
l Ba
ck
gro
un
d
�1990-p
resent:
�O
bje
ct o
rien
ted
+ W
WW
: Ja
va
, C#
�S
crip
ting
+ [O
O] +
WW
W:P
erl, P
yth
on
, PH
P, R
ub
y
�C
lien
t-Sid
e s
crip
ting
: Ja
va
Sc
ript
�C
om
po
ne
nts
an
d m
idd
lew
are
be
twe
en
op
era
ting
syste
m a
nd
a
pp
lica
tion
leve
ls
�R
eu
se
an
d d
esig
n p
atte
rns b
eco
me
use
ful a
nd
po
pu
lar
Intro
du
ctio
n-4
6
�R
eu
se
an
d d
esig
n p
atte
rns b
eco
me
use
ful a
nd
po
pu
lar
�M
ultip
le-la
ng
ua
ge
syste
ms w
ith s
tan
da
rd in
terfa
ce
-X
ML
�F
lex
ibility
in c
ho
ice
of la
ng
ua
ge
an
d m
ovin
g a
mo
ng
la
ng
ua
ge
s
Ho
w M
an
y W
ay
s to
Sa
y "H
ello
, Wo
rld"?
�In
the fo
llow
ing s
lides a
re e
xam
ple
s o
f the m
ost p
opula
r com
pute
r pro
gra
m "H
ello
, World
" in v
ario
us p
rogra
mm
ing
languages
�S
ee h
ow
many y
ou c
an re
cogniz
e?
�E
xam
ple
s a
re ta
ken (w
ith a
ltera
tions) fro
m th
e W
eb s
ite:Intro
du
ctio
n-4
7
http://www.latech.edu/~acm/HelloWorld.shtml
�M
ore
exam
ple
s a
t
http://99-bottles-of-beer.ls-la.net/
(thanks to
Mic
hael B
ar-S
inai!)
He
llo, W
orld
�A
ssem
bly
8086 (fo
r MS
DO
S):
.mo
de
l sma
ll
.stack 1
00h
.da
ta
.he
llo_
me
ssag
e d
b 'H
ello
, Wo
rld',0
dh
,0ah
,'$'
.cod
e
ma
in p
roc
Intro
du
ctio
n-4
8
ma
in p
roc
mo
v ax,@
da
ta
mo
v ds,a
x
mo
v ah
,9
mo
v dx,o
fsett h
ello
_m
essa
ge
int 2
1h
mo
v ax,4
C00h
int 2
1h
ma
in e
nd
p
en
d m
ain
He
llo, W
orld
�F
OR
TR
AN
:
cc Hello
, world
.
c
PR
OG
RA
M H
ELLO
WR
ITE
(*,10)
Intro
du
ctio
n-4
9
10 FO
RM
AT
('Hello
, world
')
EN
D
He
llo, W
orld
�P
L/I:
HE
LLO
: PR
OC
ED
UR
E O
PT
ION
S (M
AIN
);
/* A
PR
OG
RA
M T
O O
UT
PU
T H
ELLO
WO
RLD
*/
PU
T S
KIP
DA
TA
('HE
LLO
, WO
RLD
');
Intro
du
ctio
n-5
0
PU
T S
KIP
DA
TA
('HE
LLO
, WO
RLD
');
EN
D H
ELLO
;
He
llo, W
orld
�A
DA
:
with
i_o
; use
i_o
;
pro
ced
ure
he
llo is
Intro
du
ctio
n-5
1
pro
ced
ure
he
llo is
be
gin
pu
t ("He
llo, W
orld
");
en
d h
ello
;
He
llo, W
orld
�P
rolo
g:
he
llo :=
prin
tstring
("Hello
, Wo
rld").
Intro
du
ctio
n-5
2
prin
tstring
([]).
prin
tstring
([H|T
]) :=
pu
t(H),
prin
tstring
(T).
He
llo, W
orld
�S
NO
BO
L4:
OU
TP
UT
= 'H
ello
, Wo
rld‘
EN
D
Intro
du
ctio
n-5
3
He
llo, W
orld
�R
PG
II:
HFS
CR
EE
N O
F 8
0 8
0 C
RT
C E
XC
PT
Intro
du
ctio
n-5
4
C E
XC
PT
OS
CR
EE
N E
1
O 1
2 'H
EL
LO
, WO
RLD
'
He
llo, W
orld
�L
isp
:
(DE
FU
N H
EL
LO
=WO
RL
D ()
(PR
INT
(LIS
T 'H
EL
LO
'WO
RL
D)))
Intro
du
ctio
n-5
5
�S
mallT
alk
:
Tra
nscrip
t sho
w:'H
ello
, Wo
rld';cr
He
llo, W
orld
�P
osts
crip
t:
%!P
S
1.0
0000 0
.99083 sca
le
/Co
urie
r find
fon
t 12 sca
lefo
nt se
tfon
t
0 0
tran
slate
Intro
du
ctio
n-5
6
0 0
tran
slate
/row
769 d
ef
85 {
/col 1
8 d
ef 6
{co
l row
mo
veto
(He
llo, W
orld
)sho
w /co
l
col 9
0 a
dd
de
f}
rep
ea
t /row
row
9 su
b d
ef}
rep
ea
t
sho
wp
ag
e sa
ve re
store