Introduction -- Programming language syntax -- Names, scopes, and bindings -- Semantic analysis -- Target machine architecture -- Control flow -- Type systems -- Composite types -- Subroutines and control abstraction -- Data abstraction and object orientation -- Functional languages -- Logic languages -- Concurrency -- Scripting languages -- Building a runnable program -- Run-time program management -- Code improvement.;"The most comprehensive programming language textbook available today, Programming Language Pragmatics is distinguished and acclaimed for its integrated treatment of language design and language implementation. This emphasis on integration is supported by a central focus on programming language design, which together provide the reader with a solid foundation for understanding the most important issues driving software development today. The new fourth edition is updated with new material and numerous updates, including more material on interpretation; the expansion of the coverage of OCaml; new chapters devoted to Type Systems and Composite Types; reworking of the coverage of overloading, coercion, and polymorphism; and new examples featuring the ARM and x86 64-bit architectures."-- Programming Language Pragmatics, 4(2016) 990pp. 978-0-12-410409-9 Front Cover 1 Programming Language Pragmatics 4 Copyright 5 About the Author 6 Dedication 8 Contents 10 Foreword 24 Preface 26 Part I: Foundations 36 Chapter 1: Introduction 38 1.1 The Art of Language Design 40 1.2 The Programming Language Spectrum 44 1.3 Why Study Programming Languages? 47 1.4 Compilation and Interpretation 50 1.5 Programming Environments 57 1.6 An Overview of Compilation 59 1.7 Summary and Concluding Remarks 70 1.8 Exercises 71 1.9 Explorations 72 1.10 Bibliographic Notes 73 Chapter 2: Programming Language Syntax 76 2.1 Specifying Syntax: Regular Expressions and Context-Free Grammars 77 2.2 Scanning 87 2.3 Parsing 102 2.4 Theoretical Foundations 136 2.5 Summary and Concluding Remarks 137 2.6 Exercises 138 2.7 Explorations 145 2.8 Bibliographic Notes 145 Chapter 3: Names, Scopes, and Bindings 148 3.1 The Notion of Binding Time 149 3.2 Object Lifetime and Storage Management 151 3.3 Scope Rules 158 3.4 Implementing Scope 177 3.5 The Meaning of Names within a Scope 178 3.6 The Binding of Referencing Environments 185 3.7 Macro Expansion 195 3.8 Separate Compilation 198 3.9 Summary and Concluding Remarks 198 3.10 Exercises 200 3.11 Explorations 208 3.12 Bibliographic Notes 210 Chapter 4: Semantic Analysis 212 4.1 The Role of the Semantic Analyzer 213 4.2 Attribute Grammars 217 4.3 Evaluating Attributes 220 4.4 Action Routines 228 4.5 Space Management for Attributes 233 4.6 Tree Grammars and Syntax Tree Decoration 234 4.7 Summary and Concluding Remarks 241 4.8 Exercises 242 4.9 Explorations 247 4.10 Bibliographic Notes 248 Chapter 5: Target Machine Architecture 250 Part II: Core Issues in Language Design 254 Chapter 6: Control Flow 256 6.1 Expression Evaluation 257 6.2 Structured and Unstructured Flow 279 6.3 Sequencing 285 6.4 Selection 286 6.5 Iteration 294 6.6 Recursion 310 6.7 Nondeterminacy 316 6.8 Summary and Concluding Remarks 317 6.9 Exercises 319 6.10 Explorations 325 6.11 Bibliographic Notes 327 Chapter 7: Type Systems 330 7.1 Overview 331 7.2 Type Checking 345 7.3 Parametric Polymorphism 364 7.4 Equality Testing and Assignment 373 7.5 Summary and Concluding Remarks 375 7.6 Exercises 377 7.7 Explorations 380 7.8 Bibliographic Notes 381 Chapter 8: Composite Types 384 8.1 Records (Structures) 384 8.2 Arrays 392 8.3 Strings 408 8.4 Sets 409 8.5 Pointers and Recursive Types 410 8.6 Lists 431 8.7 Files and Input/Output 434 8.8 Summary and Concluding Remarks 435 8.9 Exercises 437 8.10 Explorations 442 8.11 Bibliographic Notes 443 Chapter 9: Subroutines and Control Abstraction 444 9.1 Review of Stack Layout 445 9.2 Calling Sequences 447 9.3 Parameter Passing 455 9.4 Exception Handling 473 9.5 Coroutines 483 9.6 Events 489 9.7 Summary and Concluding Remarks 494 9.8 Exercises 495 9.9 Explorations 500 9.10 Bibliographic Notes 501 Chapter 10: Data Abstraction and Object Orientation 504 10.1 Object-Oriented Programming 506 10.2 Encapsulation and Inheritance 518 10.3 Initialization and Finalization 528 10.4 Dynamic Method Binding 538 10.5 Mix-In Inheritance 549 10.6 True Multiple Inheritance 554 10.7 Object-Oriented Programming Revisited 555 10.8 Summary and Concluding Remarks 557 10.9 Exercises 558 10.10 Explorations 561 10.11 Bibliographic Notes 562 Part III: Alternative Programming Models 566 Chapter 11: Functional Languages 568 11.1 Historical Origins 569 11.2 Functional Programming Concepts 570 11.3 A Bit of Scheme 572 11.4 A Bit of OCaml 583 11.5 Evaluation Order Revisited 600 11.6 Higher-Order Functions 609 11.7 Theoretical Foundations 613 11.8 Functional Programming in Perspective 614 11.9 Summary and Concluding Remarks 616 11.10 Exercises 617 11.11 Explorations 622 11.12 Bibliographic Notes 623 Chapter 12: Logic Languages 624 12.1 Logic Programming Concepts 625 12.2 Prolog 626 12.3 Theoretical Foundations 645 12.4 Logic Programming in Perspective 646 12.5 Summary and Concluding Remarks 649 12.6 Exercises 651 12.7 Explorations 653 12.8 Bibliographic Notes 653 Chapter 13: Concurrency 656 13.1 Background and Motivation 657 13.2 Concurrent Programming Fundamentals 668 13.3 Implementing Synchronization 685 13.4 Language-Level Constructs 702 13.5 Message Passing 720 13.6 Summary and Concluding Remarks 721 13.7 Exercises 723 13.8 Explorations 728 13.9 Bibliographic Notes 730 Chapter 14: Scripting Languages 732 14.1 What Is a Scripting Language? 733 14.2 Problem Domains 737 14.3 Scripting the World Wide Web 760 14.4 Innovative Features 771 14.5 Summary and Concluding Remarks 797 14.6 Exercises 798 14.7 Explorations 802 14.8 Bibliographic Notes 804 Part IV: A Closer Look at Implementation 806 Chapter 15: Building a Runnable Program 808 15.1 Back-End Compiler Structure 808 15.2 Intermediate Forms 813 15.3 Code Generation 817 15.4 Address Space Organization 823 15.5 Assembly 825 15.6 Linking 830 15.7 Dynamic Linking 833 15.8 Summary and Concluding Remarks 835 15.9 Exercises 836 15.10 Explorations 838 15.11 Bibliographic Notes 839 Chapter 16: Run-Time Program Management 840 16.1 Virtual Machines 843 16.2 Late Binding of Machine Code 855 16.3 Inspection/Introspection 870 16.4 Summary and Concluding Remarks 883 16.5 Exercises 884 16.6 Explorations 886 16.7 Bibliographic Notes 887 Chapter 17: Code Improvement 890 A: Programming Languages Mentioned 892 B: Language Design and Language Implementation 904 C: Numbered Examples 910 Bibliography 924 Index 944 Back Cover 990
Programming Language Pragmatics, Fourth Edition, is the most comprehensive programming language textbook available today. It is distinguished and acclaimed for its integrated treatment of language design and implementation, with an emphasis on the fundamental tradeoffs that continue to drive software development.
The book provides readers with a solid foundation in the syntax, semantics, and pragmatics of the full range of programming languages, from traditional languages like C to the latest in functional, scripting, and object-oriented programming. This fourth edition has been heavily revised throughout, with expanded coverage of type systems and functional programming, a unified treatment of polymorphism, highlights of the newest language standards, and examples featuring the ARM and x86 64-bit architectures.
- Updated coverage of the latest developments in programming language design, including C & C++11, Java 8, C# 5, Scala, Go, Swift, Python 3, and HTML 5
- Updated treatment of functional programming, with extensive coverage of OCaml
- New chapters devoted to type systems and composite types
- Unified and updated treatment of polymorphism in all its forms
- New examples featuring the ARM and x86 64-bit architectures
"The most comprehensive programming language textbook available today, Programming Language Pragmatics is distinguished and acclaimed for its integrated treatment of language design and language implementation. This emphasis on integration is supported by a central focus on programming language design, which together provide the reader with a solid foundation for understanding the most important issues driving software development today. The new fourth edition is updated with new material and numerous updates, including more material on interpretation; the expansion of the coverage of OCaml; new chapters devoted to Type Systems and Composite Types; reworking of the coverage of overloading, coercion, and polymorphism; and new examples featuring the ARM and x86 64-bit architectures."-- Provided by publisher "Programming Language Pragmatics addresses the fundamental principles at work in the most important contemporary languages, highlights the critical relationship between language design and language implementation, and devotes special attention to issues of importance to the expert programmer. Thanks to its rigorous but accessible teaching style, you'll emerge better prepared to choose the best language for particular projects, to make more effective use of languages you already know, and to learn new languages quickly and completely."--BOOK JACKET. Accompanying CD-ROM contains ... "advanced/optional content, hundreds of working examples, an active search facility, and live links to manuals, tutorials, compilers, and interpreters on the World Wide Web."--Page 4 of cover