Topic I � Introduction and Motivation

Topic I � Introduction and Motivation

� Topic I � Introduction and motivation References: � Chapter 1of Concepts in programm ing languages by J. C. Mitchell. CUP, 2003. � Chapter 1of Programming languag es: Design and implementation(3 RD EDITION) by T.W. Pr tt !" M. #.$elkowit'. Prentice Hall, )***. � Chapter 1of Programming languag e pragmatics (2ND EDITION) by M. L. ,cott. El-e.ier, 2006. � 5 Goals Critic l thinking bout 1rogr 3mi!2 la!20 ge-. ? What is 1rogr 33i!2 l !20 ge45 Study 1rogr 3mi!2 la!20 ge-. � 6e f 3iliar &ith ba-ic l !20 2e concepts. � 71preciate tr de8off- i! l !20 ge design. Tr ce history, 1preci te evolution !" di.er-ity of ideas. 6e 1re1 red for !e& 1ro2r 33i!2 methods, paradigms. � 6 Why study programming languages? � To i31ro.e the ability to "e.elop effecti.e lgorithms. � To i31ro.e the 0-e of f 3ili r l !20 2es. � To incre -e the .oc b0lary of 0-ef0l pro2r 33i!2 con-truct-. � To llo& better choice of 1rogr 33i!2 l !20 2e. � To 3 %e it e -ier to lear! !e& l !20 ge. � To 3 %e it e -ier to "e-ig! ne& l !20 2e. � To -im0late 0-ef0l feat0re- in l !20 ge- that l c% them. � To 3 %e better 0-e of l !20 2e technology &here.er it 11ear-. � 7 What makes a good language? Clarity, -i31licity, !" 0!ity. Ortho2onality. N turalne-- for the 11lication. ,011ort of bstraction. E -e of pro2r 3 .eri9c tion. Progr 33i!2 e!.iro!3ent-. Portability of 1rogr 3-. � 8 Co-t of 0-e. � Co-t of e:ec0tio!. � Co-t of 1rogr 3 tr !-l tion. � Co-t of 1rogr 3 creatio!, te-ti!2, !" 0-e. � Co-t of 1rogr 3 mai!te! !ce. � 9 What makes a language successful? � E:1re--ive 1o&er. � E -e of 0-e for the !o.ice. � E -e of imple3ent tio!. � O1en -o0rce. � E:cellent co31iler-. � Eco!omic-, 1 tron 2e, !" inertia. � 10 Influences Co31uter c 1abilitie-. 71plic tio!-. Progr 33i!2 method-. I31lementatio! 3etho"-. Theoretic l -t0"ies. ,t !"ar"is tion. � 11 Applications domains Era Application Major languages Other languages )*/0- 60-i!e-- CO6O+ 7--e3bler ,cie!ti9c ;ORTR7N 7+<O+, 67,IC, 7P+ ,y-te3 7--e3bler JO#I7+, ;orth AI +I,P ,NO6O+ To" y 60-i!e-- CO6O+, ,=+, -1re "-heet C, P+>I, ?<+- ,cie!ti9c ;ORTR7N, C, C@@ 67,IC, P -c l M 1le, M the3 tic ,y-te3 6CP+, C, C@@ P -c l, 7" , 67,IC, MODU+7 AI +I,P, Prolo2 P0bli-hi!2 TEA, Po-tcri1t, &ord 1roce--i!2 Proce-- UNIA -hell, TC+, Perl M r.el, E-terel Ne& 1 r "i23- ,3 llt l%, ,M+, ( -%ell, J . Eifell, CB, ,c l Pytho!, R0by � 12 5 Why are there -o 3 !y l !20 ge-5 � E.olution. � ,1ecial 10rpo-e-. � Per-onal 1reference. � 13 ��Motivating application in l !20 ge de-i2!�� 7 -1eci9c 1ur1o-e pro.ide- focus for l !20 2e "esig!er-C it hel1- to -et criteri for 3 %in2 "e-i2! deci-io!-. 7 -1eci9c, 3otivati!2 1plic tio! lso help- to -ol.e one of the har"est 1roblems i! 1ro2r 3min2 la!20 2e de-ig!D deci"in2 &hich feat0res to lea.e out. � 14 Examples: <oo" l !20 2es de-i2!ed &ith -peci9c 10r1ose i! mind. � +I,PD -y3bolic co310tation, 0tomate" re -oni!2 � ;PD f0!ction l pro2r 3min2, algebraic la&- � 6CP+D co31iler &ritin2 � ,i30l D -i30lation � CD -y-te3- 1rogr 33i!2 � MLD theore3 1ro.i!2 � ,3 llt lkD Dy!aboo% � Clu, ,M+ Mo"ulesD 3o"0lar pro2r 3min2 � C++D object orientatio! � J . D I!ternet 11lic tio!- � 15 Program execution model <ood l !20 ge de-ig! 1resent- abstract machine. � ;ORTR7ND ;l t regi-ter 3 chineC 3emory rr !2e" - linear rr y � +I,PD co!- cell-, re "8e. l-1ri!t loop � 7lgol familyD -t c% of activatio! recor"-C he 1 -tor ge � 6CP+, CD 0!derlyin2 3 chine @ bstr ction- � ,i30l D Object references � ;P, MLD f0!ction- re b -ic co!trol -tr0ct0re � ,3 llt lkD object- !" method-, comm0!icati!2 by 3e-- ge- � J . D J . .irt0al 3 chine � 16 ��Cl --i9c tio! of 1ro2r 3mi!2 la!20 2e-�� I31erati.e 1roced0ral C,7"a,Pascal,Algol,FORTRAN,... object orie!te" cala, C#,J . , malltal!, "MU$A,... -criptin2 Perl, Pytho!, P(P, . Decl rati.e f0!ctio! l ( -%ell, ,M+, +i-1, ,che3e, . logic Prolo2 "at Fo& I", #al con-tr int8b -ed -1re "-heet- template-b -e" A,+T � 17 Theoretical foundations Examples: � ;or3 l-l !20 2e theory. � 7uto3 t theory. � 7lgorithmic-. � λ8calc0l0-. � ,e3 ntic-. � ;or3 l .erific tio!. � Ty1e theory. � Co31le:ity theory. � +ogic. � 18 Standardisation Proprietary -t !" r"-. Co!-e!-0- -t !"ar"-. � 7N,I. � IEEE. � 6,I. � I,O. � 19 Language standardisation Co!-iderD int i; i = (1 && 2) + 3 ; ? I- it .ali" C code? If -o, &hatG- the .alue of i5 ? (o& "o &e !-&er -0ch H0estio!-45 % Re " the reference 3 !0al. % Try it !" -ee4 % Re " the 7N,I C ,t !"ar". � 20 Language8standards issues Timeliness. Whe! "o &e -t !"ar"ise l !20 ge5 Conformance& What does it 3e ! for 1ro2r 3 to dhere to -t !"ar" !" for co31iler to compile -t !" r"5 Ambiguity and freedom to optimise — Machine dependence — Undefined behaviour O'solescence& Whe! "oes -t !" r" ge !" ho& "oe- it 2et 3odi9ed5 Deprecated features � 21 Language standards PL/1 ? What does the followin2 9 + 8/3 3e !5 − 11.666... 5 − O.erFo& 5 − 1.666... 5 � 22 DEC(p,q) 3e !- p "igit- &ith q fter the deci3 l point. Ty1e rule- for DECIM7+ i! P+>)D DEC(p1,q1) + DEC(p2,q2) => DEC(MIN(1+MAX(p1-q1,p2-q2)+MAX(q1,q2),15),MAX(q1,q2)) DEC(p1,q1) / DEC(p2,q2) => DEC(15,15-((p1-q1)+q2)) � 23 ;or 9 + 8/3 &e h .eD DEC(1,0) + DEC(1,0)/DEC(1,0) => DEC(1,0) + DEC(15,15-((1-0)+0)) => DEC(1,0) + DEC(15,14) => DEC(MIN(1+MAX(1- ,15-14)+MAX(0,14),15),MAX(0,1!)) => DEC(15,14) ,o the calc0lation i- - follo&- 9 + 8/3 = 9 + 2.66666666666666 = 11.66666666666666 - "#ER%&"' = 1.66666666666666 - "#ER%&"' (is*+,-( � 24 istory 1()1–)5: E:1eri3ent l 0-e of e:1res-ion compiler-. 1()+*+0: FORTRAN, CO6O+, $" P, Algol 60. 1(+1–+5: 7P+ !ot tion, 7l2ol 60 (re.i-ed), ,NO6OL, CPL. 1(++*-0: 7PL, ,NO6O+ ?, ;ORTR7N //, 67,IC, "M#$A, 7lgol /I, 7lgol8W, 6CPL. 1(-1–-5: Pascal, P+>) (,t !" rd), C, ,che3e, Prolog. 1(-+*.0: malltal!, 7" , ;ORTR7N J7, ML. � 25 1(.1–.5: ,3 llt lk8I0, Prolog, 7" I3. 1(.+*(0: C@@, M$, ( -%ell. 1((1–(5: 7" *5, TCL, Perl. 1((+*/,,0: J .a. /,,,*,5: CB, Pytho!, R0by, cala. � 26 Language groups M0lti-1ur1o-e la!20 2e- � ,c la, CB, J . , C@@, C � ( -%ell, ,M+, Scheme, LI,P � Perl, Python, R0by ,1ecial810rpo-e l !20 2es � UNIA -hell � ,=+ � +7TEA � 27 Things to think a!out What 3 %es 2oo" l !20 ge5 The role of 1. 3oti. ti!2 11lication-, 2. 1rogr 3 e:ecution, 3. theoretic l fo0!"ation- i! l !20 ge "esign. + !20 ge -t !" rdi- tion. � 28.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    24 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us