编程语言

当前位置:首页 > 网络编程 > 编程语言与程序设计 > 编程语言

出版社:塔克、 努南 清华大学出版社 (2009-05出版)
出版日期:2009-5
ISBN:9787302198062
作者:Allen Tucker,Robert Noonan
页数:590页

章节摘录

插图: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.

前言

自本书第1版于1999年出版以来,编程语言的研究已得到迅猛发展。例如,从CSl开始,Java已经成为计算机科学课程的一门重要语言。敏捷编程与软件设计如影随形,且其语言习惯有别于传统的程序。用正规的方法进行软件设计已渐入主流,且作用显著。有鉴于此,新版希望能够适应在当前和未来编程语言设计过程中所伴随的激励和新挑战。例如,新版对全部4种程序设计范例及其所用的语言在广度和深度上都有进一步的提高,如表O一1所示。新版第二个主要的变化是大大丰富了第2-11章关于语言设计原理的内容。我们使用不太正式的描述风格,增加了新的来自流行编程语言(如Python和Perl)的例子。此外,对于已经不再广泛应用的语言(如Pascal和Modula),新版多已略去。第2、4、5、7、9章主要讲述编程语言的核心原理——语法、名称、类型、语义和函数。这几章与第1版相比较,为上机学习这些原理提供了更广泛、更深入的语言和范例。如果您希望了解语法、类型系统、语义、函数和存储管理的具体实现原理,可以在第3、6、8、10和11章中找到这些材料。读者可以有选择地学习这几章,以丰富相关的核心原理。例如,通过学习第3章中编译器的词汇和语法段,可加深和巩固对第2童的学习。注意.可以跳过部分或全部的章节。

内容概要

作者:(美国)塔克 努南

书籍目录

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

编辑推荐

《编程语言:原理与范型(第2版)》是由清华大学出版社出版的。

作者简介

《编程语言:原理与范型(第2版)》以C、Java、Perl和Python编程语言为范型,介绍了编程语言的原理与设计。全书共有18章,第2~11章介绍了关于语言设计原理的内容,主要讲述编程语言的核心原理:语法、名称、类型、语义和函数等。第12~15章介绍了命令式编程、面向对象编程、函数式编程和逻辑式编程等。第16~18章详细介绍了事件处理、并发性和程序正确性。为了提高读者的上机学习能力,《编程语言:原理与范型(第2版)》为这些原理提供了丰富的应用范例。
《编程语言:原理与范型(第2版)》配套网站www.mhhe.com/tucker提供了丰富的教辅支持和参考素材。

图书封面


 编程语言下载



发布书评

 
 


精彩短评 (总计1条)

  •     这本书真无聊无趣恶心~
 

外国儿童文学,篆刻,百科,生物科学,科普,初中通用,育儿亲子,美容护肤PDF图书下载,。 零度图书网 

零度图书网 @ 2021