Concepts in Programming Languages.pdf
Concepts in Programming Languages by John Mitchell.一本国外经典教材,看了之后对编程语言更加理解。费了很多劲才找到的。Concepts in Programming LanguagesThis textbook for undergraduate and beginning graduate students explains and examines the central concepts used in modern programminglanguages, such as functions, types, memory management, and controlThe book is unique in its comprehensive presentation and comparisonof major object-oriented programming languages. Separate chapters ex-amine the history of objects, Simula and Smalltalk, and the prominentanguages c++ and JavaThe author presents foundational topics, such as lambda calculus anddenotational semantics, in an easy-to-read, informal style, focusing on themain insights provided by these theories. Advanced topics include concurrency and concurrent object-oriented programming. A chapter on logicprogramming illustrates the importance of specialized programming meth-ods for certain kinds of problemsThis book will give the reader a better understanding of the issuesand trade-offs that arise in programming language design and a betterappreciation of the advantages and pitfalls of the programming languagesthey useJohn C. mitchell is Professor of Computer Science at Stanford University,where he has been a popular teacher for more than a decade. Many of hisformer students are successful in research and private industry. He received his ph D. from mit in 1984 and was a member of technical staff atat&T Bell Laboratories before joining the faculty at Stanford. Over thepast twenty years, Mitchell has been a featured speaker at internationalconferences; has led research projects on a variety of topics, includingprogramming language design and analysis, computer security, and applications of mathematical logic to computer science; and has written morethan 100 research articles. His previous textbook, Foundations for Pro-gramming Languages(MIT Press, 1996), covers lambda calculus, typesystems, logic for program verification, and mathematical semantics ofprogramming languages. Professor Mitchell was a member of the programming language subcommittee of the ACM/ieEE Curriculum 2001standardization effort and the 2002 Program Chair of the aCm principlesof programming languages conferenceCONCEPTS NPROGRAMMINGLANGUAGESJohn c. mitchellStanford UniversityCAMBRIDGEUNIVERSITY PRESSPUBLISHED BY THE PRESS SYNDICATE OF THE UNIVERSITY OF CAMBRIDGEThe Pitt Building, Trumpington Street, Cambridge, United KingdomCAMBRIDGE UNIVERSITY PRESSThe Edinburgh Building, Cambridge CB2 2RU, UK40 West 20th Street, New York, NY 10011-4211 USA477 Williamstown Road, Port Melbourne vic 3207, AustraliaRuiz de alarcon 13, 28014 Madrid, spainDock House, The Waterfront, Cape Town 8001, South Africahttp://www.cambridge.orgo Cambridge university press 2004First published in printed format 2002isBN 0-511-03492-X eBook(adobe readerISBN 0-521-78098-5 hardbackContentsPrefacepage IxPart 1 functions and foundations1 Introduction1.1 Programming Languages1.2 Goals1.3 Programming Language History3561.4 Organization: Concepts and Languages2 Computability2. 1 Partial Functions and computability102.2 Chapter SummaryExercises163 Lisp: Functions, Recursion, and Lists3.1 Lisp History183.2 Good Language design203. 3 Brief Language overview223.4 Innovations in the Design of Lisp253.5 Chapter Summary: Contributions of LispExercises404 Fundamentals484.1 Compilers and syntax484.2 Lambda calculus4.3 Denotational semantics4.4 Functional and Imperative Languages4.5 Chapter SummaryExercisesContentsPart 2 Procedures, Types, Memory Management, and Control5 The algol Family and ML5.1 The Algol Family of Programming Languages5.2 The Development of C5.3 The LCF System and ml5.4 The Ml Programming Language1035.5 Chapter summary121Exercises1226 Type Systems and Type Inference1296.1 Types in Programming1296.2 Type Safety and Type Checking1326.3 Type Inference1356.4 Polymorphism and Overloadin1456.5 Type Declarations and Type Equality1516.6 Chapter Summary155Exercises1567 Scope, Functions, and storage Management1627.1 Block-Structured Languages1627.2 In-Line blocks1657.3 Functions and procedures1707.4 Higher-Order functions1827.5 Chapter summary190Exercises1918 Control in Sequential Languages2048.1 Structured control2048.2 Exceptions2078.3 Continuations2188.4 Functions and evaluation order2238.5 Chapter summary227Exercises8Part 3 Modularity, Abstraction, and object-Oriented Programming9 Data Abstraction and Modularity2359.1 Structured Programming2359.2 Language Support for Abstraction2429.3 Modules9.4 Generic Abstractions2599.5 Chapter Summary269Exercises27110 Concepts in Object-Oriented Languages27710.1 Object-Oriented design27710.2 Four Basic concepts in object-Oriented languages278Contents10.3 Program Structure28810.4 Design Patterns29010.5 Chapter summary29210.6 Looking Forward: Simula, SmalltalkC++Java293Exercises29411 History of objects: Simula and smalltalk30011.1 Origin of Objects in Simula30011.2 Objects in Simula30311.3 Subclasses and Subtypes in Simula30811.4 Development of smalltalk31011.5 Smalltalk Language features31211.6 Smalltalk flexibilit31811.7 Relationship between Subtyping andInheritance2211.8 Chapter SummaryExercises32712 objects and Run-Time Efficiency: C++33712.1 Design goals and Constraints33712.2 Overview of c++34012.3 Classes. Inheritance and Virtual functions34612.4 Subtyping35512.5 Multiple inheritance12.6 Chapter summary366Exercises36713 Portability and Safety: Java38413.1 Java language overview38613.2 Java Classes and Inheritance38913.3 Java Types and Subtyping39613.4 Java System architecture40413.5 Security Features41213.6 Java summary417Exercises420Part 4 Concurrency and Logic Programming14 Concurrent and Distributed Programming43114.1 Basic Concepts in Concurrency43314.2 The actor model44114.3 Concurrent ML14.4 Java concurrency45414.5 Chapter Summary466Exercises469Contents15 The Logic Programming Paradigm and Prolog47515. 1 History of logic Programming15.2 Brief Overview of the logic Programming Paradigm4715. 3 Equations solved by Unification as Atomic Actions15.4 Clauses as Parts of procedure declarations48215.5 Prologs Approach to Programming48615.6 Arithmetic in Prolog49215.7 Control, Ambivalent Syntax, and Meta-Variables49615.8 Assessment of Prolog50515.9 Bibliographic remarks50715.10 Chapter Summary507Appendix a Additional Program Examples509A 1 Procedural and Object-Oriented organization509Glossary521Index525
- 2020-12-09下载
- 积分:1
maple中文教程
maple教程,让你更好的学习maple,教程完整而且全面1.3 Maple的基本功能maillist: mathgroupowolfram comMaple的网络资源:http://www.maplesoft.comhttp://daisy.uwaterloo.caftp//ftp.maplesoft.commaillist: maple-listodaisy uwaterloo caMatlab的网络资源http://www.mathworks.comftp//ftp.mathworks.comnews: //comp. soft-sys matlabREDUCE的网络资源http://www.rrz.uni-koeln.de/reducehttp://www.zib.de/symbolik/reduceftp: //ftp. rand. org/software_and_data/reduce符号计算研究机构及信息中心http://t mcs. kelh七七p://ww.cain.nl/http://www.risc.uni-linz.ac.atnews: //sci. math. symbolic其它符号计算软件的网络地址Derivehttp://www.derive.comMacaulay2http://www.math.uiuc.edu/macaulay2/Macsymahttp://www.macsyma.comMagmahttp://www.maths.usydeduau:8000/u/magma,Mathcadhttp://www.mathsoft.com№uPadhttp://www.mupad.deScilabhttp://www-rocq.inria.fr/scilab/13 Maple的基本功能计算札代数系统与其它计算札语言的木质区别是:计算机代数系统具有符号计算的能力,为用户提供交互式的计算环境,可以进行常规的数学计算,可以根据给定的数学函数画出函数的二维或三维图形.下面我们简要描述 Maple的基本功能数值计算对于普通的数, Maple总是进行精确的计算,这种规则对于有理数和无理数是相冋的.因此对于无珥数 Maple按照有关的数学规则进行计算,只有当用户需要计算浮点数近似值时, Maple才按照用户要求的精度计算>1/5+1/49第一章 Maple系统简介5!/21evalf o%)5.7142857141f(Pi,40)3.14159265589793238462643:383279502884197>2.496745643/2;1.248372822>abs(3+5*I);>(3+4*I)/(1+工);从上面的例子可以看到,对于复薮Mape按照复数的规则进行计算.多项式符号计算系统的最基本功能是处理符号表达式,多项式则是最基本的符号表达式.从下面的例子中可以看到 Maple可以用各种方式处理多项式、三角表达式、指数与对数等许多数学表达式> factor(x^4+2*x^3-12米x^2+40*x-64(x-2)(x3+4x2-4x:+32)expand((x+1)"5)+5x4+10x3+10:2+5x+1lify (exp (x*log(y)))simplify(sin(x)2+cos(x)2)> xpand((x2-a)^3*(x+b-1));x7+x6b-26-3:5a-3x4ab+34a+3x3a2+3x2a2b-3x2a2-a3-a3b+a3expand(cos (4*x)+4*cos(2*x)+3, trig)1.3Mapl的基本功能bine(4*cos(x)"3, trig)cos (3 c)+3 cos(a)解方程用 Maple来解简单的方程是毫无问题的,即使是很复杂的方程 Maple也可以用数值计算的方法来处理.>Slve(x^2-3*x=2,x);31>g1sys:={2*x+31,x-y-z=4,3*x+7*z=3solve(glsys)24974311> fsolve({x2+y2=10,x^y=2},{x,y});{=3.102449071,y=.6122170880}矩阵计算Mapl还有许多命令可以处理矩阵和向量,不过需要调用线性代数软件包1inag.还有一点特别的是,作矩阵的乘法需要一个特殊的算子&*>with (linalg)Warning, new definition for normWarning, new definition for traceatrix([[2,3],[1,4]);2314inverse(a), det(a)([L,x],[y,z]])b:=第一章 Maple系统简介eval(a+b)2+03++y4+eval(a &* b)2w+3y2x+3+4yx+4极限,求和与乘积对于普通的求极限问题,可以接用 Maple来计算,它还可以符号的计算级数的和与积.当符号计算不成功时,还可以作数值计算>1imit((sqrt(1+x)-1)/x,x=0);limit(x!/xx, infinity);y);evalf(product(1+1/x"2, x=1.. infinity ));3.676077910微分与积分用 Maple来求微分是相当容易的,使用diff命令即可以求出数学表达式的微分,不过求出的结果可能是相当复杂,因此運常还要用 simplify命令进行化简.求数学表达式的定积分和不定积分就相对复杂一些,需要某些特定的算法.对于复杂的函数,求出的结果可能是某些特殊函数.对于定积分,还可以用eva1f求出积分的数值.simplify(diff((x-1)/(x"2+1), x));1-2diff(sin(x*y),x);g ) yint(1/(1+x+x^2),x);2cH1.3 Maple的基本功能int(sin(x 2),x=a.b)FresnelS(bint(sin (x)/x, x=o.5)eva1.549931245微分方程对于不太复杂的常微分方程, Maple可以求出它的符号解.如果你没有给初始条件,或者给的初始条什或边界条件不全,在解的公式中会带有积分常量> deq: =diff(y(x), x)*y(x)(1+x 2)=x;n:=(ny(x)y()(1+x2)dsolve(deq},{y(x)});y(a)=vIn(1+ c2), y(a)ln(1+x:2)> dsolve((y(x)2-x)*D(y)(x)+x^2-y(x)=0,{y(x)});1- y().r+oy()C1级数展开当数学问题比较复杂时,求出准确解通常是不可能的,用 serles作级数展开是有帮助的series(sin(x), x=0, 10)9+O(x5040362880例如在下列微分方程中,就是用级数方式求出的微分方程级数解>口rder:=10deq: =diff(y(x), x$2)+diff(y(x), x)+(x)=x+sin(x02v(a))+y(a)> sln1:=dsolve((deg, y(0)=0, D(y)(0)=0,y(x)1, series)3nt:y(m)=a2-1412405040x23+O(x21)20160181440第一章 Maple系统筒介Laplace和 Fourier变换Laplace变换和 Fourier变换是常用的数学变换.在 Maple中有一个积分变换的程序包inttrans提供了各种积分变换和它们的逆变换with (inttrans)s);s cos(a)+sin(a+1invlaplace(%,s, t)(a)cos(t)+sin(a)sin(tcombine(%, trig);(t-a)alias(sigma=Heaviside)f: =sigma(t+1)g: =simplify(fourier(f, t, w))I(T Dirac(an)w-Dsin(an)插值与函数拟合的像々命令可以由m个点出发计算m-1阶的插值多项式.在下例中的取值是1到10y的值是1到10之间的10个随机数f是相应的插值多项式datax:=[seq (i, i=1.10)]> data:=[seq(rand(10)(),i=1..10)]dataxy: =zip((x, y)->Lx,y], datax, datay)dater:=[1,1],②2,0],[3.7,[4,3],⑤,6],6,8,[7,5,8,8],[⑨,1,[10,9f:=interp(datax, data, x)1751711699371927323176741652577518404U3206048028801728057603240l8116483166915333602520x-2使用数值逼近程序包 numapprox中的pade命令可以计算一个给定函数的有理逼近函数以及其它类型的逼近函数with(numapprox)>x0:= solve(x^2=Pi/2)[1]T1.3 Maple的基本功能>f:=pade(tan(x^2),x=x0,[3,3])f:=(-17280m19/2√2+10800%17+43200%138-76809%13x103072%12m25/2√2-324007152V2+3840x232√2+2880%179+30729%13712+2010%2x2¥2-14100%1x2y2-1520%1m2)/(-11520丌1+1024x13-1400x9-10800)%1+(7680x23/22-115209/2v2+21600m15/2v2%12+(-7680m12+3156010+648007)%1)1:=evalf(normal(f))45329581221092-.1125313130109+10541843601093+.5353835473109x)/(2(.109716870010x2+.S958248690103-,135628886010)图形最常用的画图命令是plot和plot3d.下面的例子说明了使用在两个命令的方法>plot(sin(x)*exp(1)^(-x/7),x=0,,4*Pi);plot 3d(sin(x)exp(1)"y, x=0.. 2*Pi, y=0.. Pi, axes=boxedMaple编程Maple不仅可以对数学表达式进行计算,还可以编程.他的编程语言和其它的结构化编程语言很相似第一章 Maple系统简介f(x:: nonnegint)2 option rememberif x=0 then olif x=1 then 1else f(x-1)+f(x-2) end ifend>f(40)10233415514 Maple系统的交互使用Maple的窗口环境提供了先进的工作区界面.其护充的数学功能简明易用,用户可以在其中展现数学思想,创建复杂的技术报告,充分发挥 Maple的功能图1.1: Maple的窗凵环境B6型团囚K9 United [u]. 5e e11C wOrksheet ElementsABTAEZHIKAMint((PI/2)3in(x)+22,:NEOIPLYXΩI cor]+-plo({-1/2too8(x),x=10.,10际回四a Maple的上具条B内容工具条,它还包含一个输入和编辑文本的区域C节的头部及标题D Maple的输入,提小符为“>”,显小为红色
- 2020-12-08下载
- 积分:1