Programming Language Design Concepts (Paperback)
暫譯: 程式語言設計概念 (平裝本)

David A. Watt

買這商品的人也買了...

相關主題

商品描述

Description:

Programming languages exist to communicate with computers and also with people. A good language, like a good mathematical notation, helps us to formulate and communicate ideas more quickly. Yet there are many programming languages and many features to understand in each.

Reflecting current trends where object-oriented (OO) programming has taken over from imperative programming as the dominant paradigm, this book gives greatest prominence to the OO paradigm using Java and C++ as the main exemplar languages. Similarly, since the Web has revolutionized the computing industry, the need for examination of scripting languages, such as Perl and Python, has risen. With additional case study languages including Python, Haskell, Prolog and Ada, Programming Language Design Concepts deepens study by examining the motivation of programming languages rather than just their features. ,P.All programmers, not just language specialists, need a thorough understanding of language concepts in order to get the best of these most fundamental tools. This book explains the basic concepts that underpin all programming languages, and shows how these concepts are synthesized in the major paradigms: imperative, object-oriented, concurrent, functional, logic and scripting.

Written in a clear, approachable style, ideal for classroom and self-study, the book includes numerous examples, case studies of several major programming languages, and end-of-chapter exercises. Sample solutions to exercises are available on the companion website. Companion website: www.dcs.gla.ac.uk/~daw/books/PLDC/

Table of Contents:

Preface.

PART I: INTRODUCTION.

1. Programming Languages.

1.1 Programming linguistics.

1.1.1 Concepts and paradigms.

1.1.2 Syntax, semantics, and pragmatics.

1.1.3 Language processors.

1.2 Historical development.

Summary.

Further reading.

Exercises.

PART II: BASIC CONCEPTS

2. Values and Types.

2.1 Types.

2.2 Primitive types.

2.2.1 Built-in primitive types.

2.2.2 Defined primitive types.

2.2.3 Discrete primitive types.

2.3 Composite types.

2.3.1 Cartesian products, structures, and records.

2.3.2 Mappings, arrays, and functions.

2.3.3 Disjoint unions, discriminated records, and objects.

2.4 Recursive types.

2.4.1 Lists.

2.4.2 Strings.

2.4.3 Recursive types in general.

2.5 Type systems.

2.5.1 Static vs dynamic typing.

2.5.2 Type equivalence.

2.5.3 The Type Completeness Principle.

2.6 Expressions.

2.6.1 Literals.

2. 6.2 Constructions.

2.6.3 Function calls.

2.6.4 Conditional expressions.

2.6.5 Iterative expressions.

2.6.6 Constant and variable accesses.

2.7 Implementation notes.

2.7.1 Representation of primitive types.

2.7.2 Representation of Cartesian products.

2.7.3 Representation of arrays.

2.7.4 Representation of disjoint unions.

2.7.5 Representation of recursive types.

Summary.

Further reading.

Exercises.

3. Variables and Storage.

3.1 Variables and storage.

3.2 Simple variables.

3.3 Composite variables.

3.3.1 Total vs selective update.

3.3.2 Static vs dynamic vs flexible arrays.

3.4 Copy semantics vs reference semantics.

3.5 Lifetime.

3.5.1 Global and local variables.

3.5.2 Heap variables.

3.5.3 Persistent variables.

3.6 Pointers.

3.6.1 Pointers and recursive types.

3.6.2 Dangling pointers.

3.7 Commands.

3.7.1 Skips.

3.7.2 Assignments.

3.7.3 Procedure calls.

3.7.4 Sequential commands.

3.7.5 Collateral commands.

3.7.6 Conditional commands.

3.7.7 Iterative commands.

3.8 Expressions with side effects.

3.8.1 Command expressions.

3.8.2 Expression-oriented languages.

3.9 Implementation notes

3.9.1 Storage for global and local variables.

3.9.2 Storage for heap variables.

Summary.

Further reading.

Exercises.

4. Bindings and Scope.

4.1 Bindings and environments.

4.2 Scope.

4.2.1 Block structure.

4.2.2 Scope and visibility.

4.2.3 Static vs dynamic scoping.

4.3 Declarations.

4.3.1 Type declarations.

4.3.2 Constant declarations.

4.3.3 Variable declarations.

4.3.4 Procedure definitions.

4.3.5 Collateral declarations.

4.3.6 Sequential declarations.

4.3.6 Recursive declarations.

4.3.8 Scopes of declarations.

4.4 Blocks.

4.4.1 Block commands.

4.4.2 Block expressions.

4.4.3 The Qualification Principle.

Summary.

Further reading.

Exercises.

5. Procedural Abstraction.

5.1 Function procedures and proper procedures.

5.1.1 Function procedures.

5.1.2 Proper procedures

5.1.3 The Abstraction Principle.

5.2 Parameters and arguments.

5.2.1 Copy parameter mechanisms.

5.2.2 Reference parameter mechanisms.

5.2.3 The Correspondence Principle.

5.3 Implementation notes

5.3.1 Implementation of procedure calls.

5.3.1 Implementation of parameter passing.

Summary.

Further reading.

Exercises.

PART III: ADVANCED CONCEPTS.

6. Data Abstraction.

6.1 Program units, packages, and encapsulation.

6.1.1 Packages.

6.1.2 Encapsulation.

6.2 Abstract types.

6.3 Objects and classes.

6.3.1 Classes.

6.3.2 Subclasses and inheritance.

6.3.3 Abstract classes.

6.3.4. Single vs multiple inheritance.

6.3.5 Interfaces.

6.4 Implementation notes.

6.4.1 Representation of objects

6.4.2 Implementation of method calls.

Summary.

Further reading

Exercises.

7. Generic Abstraction.

7.1 Generic units and instantiation.

7.1.1 Generic packages in ADA.

7.1.2 Generic classes in C++.

7.2 Type and class parameters.

7.2.1 Type parameters in ADA.

7.2.2 Type parameters in C++.

7.2.3 Class parameters in JAVA.

7.3 Implementation notes

7.3.1 Implementation of ADA generic units.

7.3.2 Implementation of C++ generic units.

7.3.3 Implementation of JAVA generic units.

Summary.

Further reading.

Exercises

8. Type Systems.

8.1 Inclusion polymorphism.

8.1.1 Types and subtypes.

8.1.2 Classes and subclasses.

8.2 Parametric polymorphism.

8.2.1 Polymorphic procedures.

8.2.2 Parameterized types.

8.2.3 Type inference.

8.3 Overloading.

8.4 Type conversions.

8.5 Implementation notes

8.5.1 Implementation of polymorphic procedures.

Summary.

Further reading.

Exercises.

9. Control Flow.

9.1 Sequencers.

9.2 Jumps.

9.3 Escapes.

9.4 Exceptions.

9.5 Implementation notes

9.5.1 Implementation of jumps and escapes.

9.5.2 Implementation of exceptions.

Summary.

Further reading.

Exercises.

10. Concurrency (by William Findlay).

10.1 Why concurrency?.

10.2 Programs and processes.

10.3 Problems with concurrency.

10.3.1 Nondeterminism.

10.3.2 Speed dependence.

10.3.3 Deadlock.

10.3.4 Starvation.

10.4 Process interactions.

10.4.1 Independent processes.

10.4.2 Competing processes.

10.4.3 Communicating processes.

10.5 Concurrency primitives.

10.5.1 Process creation and control.

10.5.2 Interrupts.

10.5.3 Spin locks and wait-free algorithms.

10.5.4 Events.

10.5.5 Semaphores.

10.5.6 Messages.

10.5.7 Remote procedure calls.

10.6 Concurrent control abstractions.

10.6.1 Conditional critical regions.

10.6.2 Monitors.

10.6.3 Rendezvous.

Summary.

Further reading.

Exercises.

PART IV: PARADIGMS

11. Imperative Programming.

11.1 Key concepts.

11.2 Pragmatics.

11.2.1 A simple spellchecker.

11.3 Case study: C.

11.3.1 Values and types.

11.3.2 Variables, storage, and control.

11.3.3 Bindings and scope.

11.3.4 Procedural abstraction.

11.3.5 Independent compilation.

11.3.6 Preprocessor directives.

11.3.7 Function library.

11.3.8 A simple spellchecker.

11.4 Case study: ADA.

11.4.1 Values and types.

11.4.2 Variables, storage, and control.

11.4.3 Bindings and scope.

11.4.4 Procedural abstraction.

11.4.5 Data abstraction.

11.4.6 Generic abstraction.

11.4.7 Separate compilation.

11.4.8 Package library.

11.4.9 A simple spellchecker.

Summary.

Further reading.

Exercises.

12. Object-Oriented Programming.

12.1 Key Concepts.

12.2 Pragmatics.

12.3 Case study: C++.

12.3.1 Values and types.

12.3.2 Variables, storage, and control.

12.3.3 Bindings and scope.

12.3.4 Procedural abstraction.

12.3.5 Data abstraction.

12.3.6 Generic abstraction.

12.3.7 Independent compilation and preprocessor directives

12.3.8 Class and template library.

12.3.9 A simple spellchecker.

12.4 Case study: JAVA.

12.4.1 Values and types.

12.4.2 Variables, storage, and control.

12.4.3 Bindings and scope.

12.4.4 Procedural abstraction.

12.4.5 Data abstraction.

12.4.6 Generic abstraction.

12.4.7 Separate compilation and dynamic linking.

12.4.8 Class library.

12.4.9 A simple spellchecker.

12.5 Case study: ADA95.

12.5.1 Types.

12.5.2 Data abstraction.

Summary.

Further reading.

Exercises.

13. Concurrent Programming (by William Findlay).

13.1 Key concepts.

13.2 Pragmatics.

13.3 Case study: ADA95.

13.3.1 Process creation and termination.

13.3.2 Mutual exclusion.

13.3.3 Admission control.

13.3.4 Scheduling away deadlock.

13.4 Case study: JAVA.

13.4.1 Process creation and termination.

13.4.2 Mutual exclusion.

13.4.3 Admission control.

Summary.

Further reading.

Exercises.

14. Functional Programming.

14.1 Key concepts.

14.1.1 Eager vs normal-order vs lazy evaluation.

14.2 Pragmatics.

14.3 Case study: HASKELL.

14.3.1 Values and types.

14.3.2 Bindings and scope.

14.3.3 Procedural abstraction.

14.3.4 Lazy evaluation.

14.3.5 Data abstraction.

14.3.6 Generic abstraction.

14.3.7 Modeling state.

14.3.8 A simple spellchecker.

Summary.

Further reading.

Exercises.

15. Logic Programming.

15.1 Key concepts.

15.2 Pragmatics.

15.3 Case study: PROLOG.

15.3.1 Values, variables, and terms.

15.3.2 Assertions and clauses.

15.3.3 Relations.

15.3.4 The closed-world assumption.

15.3.5 Bindings and scope.

15.3.6 Control.

15.3.7 Input/output.

15.3.8 A simple spellchecker.

Summary.

Further reading.

Exercises

16. Scripting.

16.1 Pragmatics.

16.1.1 Regular expressions.

16.2 Case study: PYTHON.

16.2.1 Values and types.

16.2.2 Variables, storage, and control

16.2.3 Bindings and scope.

16.2.4 Procedural abstraction.

16.2.5 Data abstraction.

16.2.6 Separate compilation

16.2.7 Module library.

Summary.

Further reading.

Exercises.

PART V: CONCLUSION.

17. Language Selection.

17.1 Criteria.

17.2 Evaluation.

Summary.

Exercises.

18. Language Design.

18.1 Selection of concepts.

18.2 Regularity.

18.3 Simplicity.

18.4 Efficiency.

18.5 Syntax.

18.6 Language life cycles.

18.7 The future.

Summary.

Further reading.

Exercises.

Bibliography.

Glossary.

Index.

商品描述(中文翻譯)

**描述:**
程式語言的存在是為了與電腦以及人類進行溝通。一種好的語言,就像一種好的數學符號,能幫助我們更快速地表達和傳達想法。然而,程式語言種類繁多,每種語言都有許多特性需要理解。
本書反映了當前的趨勢,即物件導向(OO)程式設計已取代命令式程式設計成為主流範式,並以 Java 和 C++ 作為主要範例語言,突顯 OO 範式。同樣地,隨著網路革命化了計算機產業,對於腳本語言(如 Perl 和 Python)的研究需求也隨之上升。除了 Python,還包括 Haskell、Prolog 和 Ada 等案例研究語言,《程式語言設計概念》深入探討程式語言的動機,而不僅僅是它們的特性。所有程式設計師,而不僅僅是語言專家,都需要徹底理解語言概念,以便充分利用這些最基本的工具。本書解釋了所有程式語言的基本概念,並展示這些概念如何在主要範式中綜合:命令式、物件導向、並行、函數式、邏輯和腳本。
本書以清晰易懂的風格撰寫,適合課堂和自學,包含大量範例、幾種主要程式語言的案例研究,以及章末練習。練習的範例解答可在伴隨網站上獲得。伴隨網站:www.dcs.gla.ac.uk/~daw/books/PLDC/

**目錄:**
前言。
第一部分:介紹。
1. 程式語言。
1.1 程式語言學。
1.1.1 概念與範式。
1.1.2 語法、語意與語用。
1.1.3 語言處理器。
1.2 歷史發展。
摘要。
進一步閱讀。
練習。
第二部分:基本概念
2. 值與類型。
2.1 類型。
2.2 原始類型。
2.2.1 內建原始類型。
2.2.2 定義的原始類型。
2.2.3 離散原始類型。
2.3 複合類型。
2.3.1 笛卡爾積、結構與記錄。
2.3.2 對應、陣列與函數。
2.3.3 不相交的聯集、區分記錄與物件。
2.4 遞歸類型。
2.4.1 列表。
2.4.2 字串。
2.4.3 一般的遞歸類型。
2.5 類型系統。
2.5.1 靜態與動態類型。
2.5.2 類型等價。
2.5.3 類型完整性原則。
2.6 表達式。
2.6.1 字面量。
2.6.2 結構。
2.6.3 函數呼叫。
2.6.4 條件表達式。
2.6.5 迭代表達式。
2.6.6 常數與變數存取。
2.7 實作註解。
2.7.1 原始類型的表示。
2.7.2 笛卡爾積的表示。
2.7.3 陣列的表示。
2.7.4 不相交聯集的表示。
2.7.5 遞歸類型的表示。
摘要。
進一步閱讀。
練習。
3. 變數與儲存。
3.1 變數與儲存。
3.2 簡單變數。
3.3 複合變數。
3.3.1 總更新與選擇性更新。
3.3.2 靜態、動態與靈活陣列。
3.4 複製語意與參考語意。
3.5 生命週期。
3.5.1 全域與區域變數。
3.5.2 堆變數。
3.5.3 持久變數。
3.6 指標。
3.6.1 指標與遞歸類型。
3.6.2 懸空指標。
3.7 命令。
3.7.1 跳過。
3.7.2 指派。
3.7.3 程序呼叫。
3.7.4 順序命令。
3.7.5 附帶命令。
3.7.6 條件命令。
3.7.7 迭代命令。
3.8 具有副作用的表達式。
3.8.1 命令表達式。
3.8.2 表達式導向語言。
3.9 實作註解
3.9.1 全域與區域變數的儲存。
3.9.2 堆變數的儲存。
摘要。
進一步閱讀。
練習。
4. 綁定與範圍。
4.1 綁定與環境。
4.2 範圍。
4.2.1 區塊結構。
4.2.2 範圍與可見性。
4.2.3 靜態與動態範圍。
4.3 聲明。
4.3.1 類型聲明。
4.3.2 常數聲明。
4.3.3 變數聲明。
4.3.4 程序定義。
4.3.5 附帶聲明。
4.3.6 順序聲明。
4.3.7 遞歸聲明。
4.3.8 聲明的範圍。
4.4 區塊。
4.4.1 區塊命令。
4.4.2 區塊表達式。
4.4.3 資格原則。
摘要。
進一步閱讀。
練習。
5. 程序抽象。
5.1 函數程序與適當程序。
5.1.1 函數程序。
5.1.2 適當程序
5.1.3 抽象原則。
5.2 參數與引數。
5.2.1 複製參數機制。
5.2.2 參考參數機制。
5.2.3 對應原則。
5.3 實作註解
5.3.1 程序呼叫的實作。
5.3.2 參數傳遞的實作。
摘要。
進一步閱讀。
練習。
第三部分:進階概念。
6. 數據抽象。
6.1 程序單元、包與封裝。
6.1.1 包。
6.1.2 封裝。
6.2 抽象類型。
6.3 物件與類別。
6.3.1 類別。
6.3.2 子類別與繼承。
6.3.3 抽象類別。
6.3.4 單一繼承與多重繼承。
6.3.5 介面。
6.4 實作註解。
6.4.1 物件的表示
6.4.2 方法呼叫的實作。
摘要。
進一步閱讀
練習。
7. 泛型抽象。
7.1 泛型單元與實例化。
7.1.1 ADA 中的泛型包。
7.1.2 C++ 中的泛型類別。
7.2 類型與類別參數。
7.2.1 ADA 中的類型參數。
7.2.2 C++ 中的類型參數。
7.2.3 JAVA 中的類別參數。
7.3 實作註解
7.3.1 ADA 泛型的實作。