編程語言

出版時間:2009-5  出版社:塔克、 努南 清華大學(xué)出版社 (2009-05出版)  作者:Allen Tucker,Robert Noonan  頁數(shù):590  
Tag標(biāo)簽:無  

前言

自本書第1版于1999年出版以來,編程語言的研究已得到迅猛發(fā)展。例如,從CSl開始,Java已經(jīng)成為計算機(jī)科學(xué)課程的一門重要語言。敏捷編程與軟件設(shè)計如影隨形,且其語言習(xí)慣有別于傳統(tǒng)的程序。用正規(guī)的方法進(jìn)行軟件設(shè)計已漸入主流,且作用顯著。有鑒于此,新版希望能夠適應(yīng)在當(dāng)前和未來編程語言設(shè)計過程中所伴隨的激勵和新挑戰(zhàn)。例如,新版對全部4種程序設(shè)計范例及其所用的語言在廣度和深度上都有進(jìn)一步的提高,如表O一1所示。新版第二個主要的變化是大大豐富了第2-11章關(guān)于語言設(shè)計原理的內(nèi)容。我們使用不太正式的描述風(fēng)格,增加了新的來自流行編程語言(如Python和Perl)的例子。此外,對于已經(jīng)不再廣泛應(yīng)用的語言(如Pascal和Modula),新版多已略去。第2、4、5、7、9章主要講述編程語言的核心原理——語法、名稱、類型、語義和函數(shù)。這幾章與第1版相比較,為上機(jī)學(xué)習(xí)這些原理提供了更廣泛、更深入的語言和范例。如果您希望了解語法、類型系統(tǒng)、語義、函數(shù)和存儲管理的具體實現(xiàn)原理,可以在第3、6、8、10和11章中找到這些材料。讀者可以有選擇地學(xué)習(xí)這幾章,以豐富相關(guān)的核心原理。例如,通過學(xué)習(xí)第3章中編譯器的詞匯和語法段,可加深和鞏固對第2童的學(xué)習(xí)。注意.可以跳過部分或全部的章節(jié)。

內(nèi)容概要

  《編程語言:原理與范型(第2版)》以C、Java、Perl和Python編程語言為范型,介紹了編程語言的原理與設(shè)計。全書共有18章,第2~11章介紹了關(guān)于語言設(shè)計原理的內(nèi)容,主要講述編程語言的核心原理:語法、名稱、類型、語義和函數(shù)等。第12~15章介紹了命令式編程、面向?qū)ο缶幊?、函?shù)式編程和邏輯式編程等。第16~18章詳細(xì)介紹了事件處理、并發(fā)性和程序正確性。為了提高讀者的上機(jī)學(xué)習(xí)能力,《編程語言:原理與范型(第2版)》為這些原理提供了豐富的應(yīng)用范例。

作者簡介

作者:(美國)塔克 努南

書籍目錄

1 Overview1.1 Principles1.2 Paradigms1.3 SpecialTopics1.4 ABriefHistory1.5 OnLanguageDesign1.5.1 DesignConstraints1.5.2 OutomesandGDals1.6 CompilersandVirtualMachines1.7 SummaryExercises2 Syntax2.1 Grammars2.1.1 Backus.NaurForm(BNF)Grammars2.1.2 Derivations2.1.3 ParseTrees2.1.4 AssociativityandPrecedence2.1.5 AmbigUOUSGrammars2.2 ExtendedBNF2.3 SyntaxofaSmallLanguage:Clite2.3.1 LexicalSyntax2.3.2 ConcreteSyntax2.4 CompilersandInterpreters2.5 LinkingSyntaxandSemantics2.5.1 AbstractSyntax2.5.2 AbstractSyntaxTretes2.5.3 AbstractSyntaxofClite2.6 SummaryExercises3 LexicalandSyntacticAnalysis3.1 ChomskyHierarchy3.2 LexicalAnalysis3.2.1 RegularExpressions3.2.2 FiniteStateAutomata3.2.3 FromDesigntoCode3.3 SyntacticAnalysis3.3.1 PreliminaryDefinitions3.3.2 RecursiveDescentParsin3.4 SummaryExercises4 Names4.1 SyntacticIssues4.2 Variables4.3 Scope4.4 SymbolTable4.5 ResolvingReferences4.6 DynamicScoping4.7 Visibility4.8 Overloading4.9 Lifetime4.1 0SummaryExercises5 Types5.1 TypeErrors5.2 StaticandDynamicTDyping5.3 BasicTypes5.4 NonbasicTypes5.4.1 Eumerations5.4.2 Pointers5.4.3 ArraysandLists5.4.4 Strings5.4.5 Structures5.4.6 VariantRecordsandUnions5.5 RecursiveDataTypes5.6 FunctionsasTypes5.7 TypeEquivalence5.8 Subtypes5.9 PolymorphismandGenerics5.1 0Programmer.DefinedTypes5.1 1SummaryExercises6 TypeSystems6.1 TypeSystemforClite6.2 ImplicitTypeConversion6.3 FormalizingtheCliteTYpeSystem6.4 SummaryExercises7 Semantics7.1 Motivation7.2 ExpressionSemantics7.2.1 Notation7.2.2 AssociativityandPrecedence7.2.3 shoftCircuitEvaluation7.2.4 TheMeaningofanExpression7.3 ProgramState7.4 AssignmentSemantics7.4.1 MultipleAssignment7.4.2 AssigrnmentStatementsVS.AssignmentExpressions7.4.3 CopyVS.ReferenceSemantics7.5 ControlFlowSemantics7.5.1 Sequence7.5.2 Conditionals7.5.3 Loops7.5.4 GoToControversy7.6 Input/OutputSemantics7.6.1 BasicConcepts7.6.2 RandomAccessFiles7.6.3 gOErrorHandlingSemantics7.7 ExceptionHandingSemantics7.7.1 StrategiesandDesignIssues7.7.2 ExceptionHandlinginAda,C++,andJava7.7.3 ExcepKonsandAssertions7.8 SummaryExercises8 SemanticInterpretation8.1 StateTransformationsandPartialFuncfions8.2 SemanticsofClite8.2.1 MeaningofaProgram8.2.2 StatementSemantics8.2.3 ExpressionSemantics8.2.4 ExpressionswithSideEffects8.3 SemanticswithDynamScTyping8.4 AFormalTreatmentofSemantics8.4.1 StateandStateTransformation8.4.2 DenotationafSemanticsofaProgram8.4.3 DenotationalSemanticsofStatements8.4.4 DenotationalSemanticsofExpressions8.4.5 LimitsofFormalSemanticModels8.5 SummaryExercises9 Functions9.1 BasicTerminology9.2 FunctionCallandReturn9.3 Parameters9.4 ParameterPassingMechanisms9.4.1 Passbyvalue9.4.2 PassbyReference9.4.3 PassbyValue.ResultandResult9.4.4 PassbyName9.4.5 ParameterPassinginAda9.5 ActivationRecords9.6 RecursiveFunctions9.7 Run-TimeStack9.8 SummaryExercises10 FunctionImplementation10.1 FunctionDeclarationandCallinClite10.1.1 ConcreteSyntax10.1.2 AbstractSyntax10.2 CompletingtheCliteTypeSystem10.3 SemanticsofFunctionCallandReturn10.3.1 Non.VoidFunctions10.3.2 SideEffectsRevisited10.4 FormalTreatmentofTypesandSemantics10.4.1 TypeMapsforClite10.4.2 FormalizingtheTypeRulesforClite10.4.3 FormalizingtheSemanticsofClite10.5 SummaryExercises11 MemoryManagement11.1 TheHeap11.2 ImplementationofDynamicArrays11.2.1 HeapManagementProblems:Garbage11.3 GarbageCollection11.3.1 ReferenceCounting11.3.2 Mark-Sweep11.3.3 CopyCollection11.3.4 ComparisonofStrategies11.4 SummaryExercises12 ImperativeProgramming12.1 WhatMakesaLanguageImperative?12.2 ProceduralAbstraction12.3 ExpressionsandAssignment12.4 LibrarySupportforDataStructures12.5 ImperativeProgrammingandC12.5.1 GeneralCharacteristics12.5.2 Example:Grep12.5.3 Example:Average12.5.4 Example:SymbolicDifferentiation12.6 ImperativeProgrammingandADA12.6.1 GeneralCharacteristics12.6.2 Example:Average12.6.3 Example:MatrixMultiplication12.7 ImperativeProgrammingandPerl12.7.1 GeneralCharacteristics12.7.2 Example:Grep12.7.3 Example:MailingGrades12.8 SummaryExercises13 Obiect.OrientedProgramming13.1 Prelude:AbstractDataTypes13.2 TheObjectModel13.2.1 Classes13.2.2 VisibilityandInformationHiding13.2.3 Inheritance13.2.4 MultipleInheritance13.2.5 Polymorphism13.2.6 Templates13.2.7 AbstractClasses13.2.8 Interfaces13.2.9 VirtualMethodTable13.2.1 0Run-TimeTypeIdentification13.2.1 1Reflection13.3 Smalltalk13.3.1 GeneralCharacte-ristics13.3.2 Example:Polynomials13.3.3 Example:ComplexNumbers13.3.4 Example:BankAccount13.4 Java13.4.1 Example:SymbolicDifferentiation13.4.2 Example:Backtracking13.5 Pvthon13.5.1 GeneralCharacteristics13.5.2 Example:Polynomials13.5.3 Example:Fractions13.6 SummaryExercises14 FunctionalProgramming14.1 FunctionsandtheLambdaCalculus14.2 Scheme14.2.1 Expressions14.2.2 ExpressionEvaluation14.2.3 Lists14.2.4 ElementaryValues14.2.5 ControlFlow14.2.6 DefiningFunctions14.2.7 LetExpressions14.2.8 Example:SemanticsofClite14.2.9 Example:SymbolicDifferentiafion14.2.1 0Example:EightQueens14.3 Haskell14.3.1 Introduction14.3.2 Expressions14.3.3 ListsandListComprehensions14.3.4 ElementaryTypesandValues14.3.5 ControlFlow14.3.6 Definingfunctions14.3.7 Tuples14.3.8 Example:SemanticsofClite14.3.9 Example:SymbolicDifferentiation14.3.1 0Example:EightQueens14.4 SummaryExercises15 LogicProgramming15.1 LogicandHornClauses15.1.1 ResolutionandUnification15.2 LogicProgramminginProlog15.2.1 PrologProgramElements15.2.2 PracticalAspectsofProlog15.3 PrologExamples15.3.1 SymbolicDifferentiation15.3.2 SolvingWordPuzzles15.3.3 NaturalLanguageProcessing15.3.4 SemanticsofClite15.3.5 EightQueensProblem15.4 SummaryExercises16 Event.DrivenProgramming16.1 Event-DrivenControl16.1.1 ModeZ-View-Controller16.1.2 EventsinJava16.1.3 JavaGUIApplications16.2 EventHandling16.2.1 MouseClicks16.2.2 MouseMotion16.2.3 Buttons16.2.4 Labels,TextAreas,andTextFields16.2.5 ComboBoxes16.3 ThreeExamples16.3.1 ASimpleGUIInterface16.3.2 DesigningaJavaApplet16.3.3 Event.DrivenInteractiveGames16.4 OtherEvent.DrivenApplications16.4.1 ATMMachine16.4.2 HomeSecuritySystem16.5 SummaryExercises17 ConcurrentProgramming17.1 ConcurrencyConcepts17.1.1 HistoryandDefinitions17.1.2 ThreadControlandCommunication17.1.3 RacesandDeadlocks17.2 SynchronizationStrategies17.2.1 Semaphores17.2.2 Monitors……18 ProgramCorrectnessA DefinitionofCliteB DiscreteMathReview

章節(jié)摘錄

插圖:Definition:A context-free grammar has a set of productions P,a set of terminal symbols T and a set of nonterminal symbols N,one of which,S,is distinguished as the start symbo1.Definition:AgrammarproductionhastheformA一∞whereAisanonterminal symbol and cois a stringofnonterminalandterminal symbols.One form of context-free grammar,called Backus-Naur Form(BNF for short)hasbeen widely used to define the syntax of programming languages.2.1.1 Backus-Naur Form(BNF)GrammarsIn 1960,BNF was adapted from Chomsky,s theory by John Backus and Peter Naur to express a formal syntactic definition for the programming language Algol[Naur(ed.), 1963].Like many texts, we use the term BNF grammar as a synonym for context free grammar.For a more complete discussion of the differences between the two,see Observation(P.26).Aproductionis aruleforrewritingthatcanbeappliedtoa stringofsymbolscalleda sententialform.Aproduction is interpreted as follows:the nonterminalA can be replaced by in a sententialform.The symbol A is often called the left-handside,whilethe string is called the right.hand side of the production.In BNF grammars,the sets of terminaland nonterminal symbols are disjoint.  When a BNF grammar is used for defining programming language syntax,the nonterminals N identify the language’s grammatical categories like Identifier,Inte。ger,Expression,Statement,and Program.The start symbol S identifies the principal grammatical category being defined by the grammar(typically Program),and is usually defined in the first production.The terminal symbols T form the basic alphabet from which programs are constructed.To illustrate these ideas,here is a pair of productions that defines the syntax of the grammatical category binaryDigit:binaryDigit-0binaryDigit-1This pair defines a binaryDigit as either 0 or 1,but nothing else.The nonterminal sym-bols are all the symbols that appear on the left-hand side of at least one production.For the above grammar,binaryDigit is the only nonterminal.The terminal symbols are a11 the other symbols that appear in the productions;for the above grammar,0 and 1 arethe terminal symbols.When a series ofproductions all have the same nonterminal symbol on their left-hand sides,they may be combined into a single production.For example,the above two productions can be abbreviated by:binaryDigit一0In this case.the alternatives are separated by a vertical bar(I),which literally means“or,”so the interpretation remains the same as the original pair of productions.In this example,both the fight arrow and vertical bar are metasymbols,whichare symbols that are part of the metalanguage and are not part of the language being defined.

編輯推薦

《編程語言:原理與范型(第2版)》是由清華大學(xué)出版社出版的。

圖書封面

圖書標(biāo)簽Tags

評論、評分、閱讀與下載


    編程語言 PDF格式下載


用戶評論 (總計0條)

 
 

 

250萬本中文圖書簡介、評論、評分,PDF格式免費(fèi)下載。 第一圖書網(wǎng) 手機(jī)版

京ICP備13047387號-7