| |
| |
Preface | |
| |
| |
| |
Introduction | |
| |
| |
| |
Programming languages | |
| |
| |
| |
Programming linguistics | |
| |
| |
| |
Concepts and paradigms | |
| |
| |
| |
Syntax, semantics, and pragmatics | |
| |
| |
| |
Language processors | |
| |
| |
| |
Historical development | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Basic Concepts | |
| |
| |
| |
Values and types | |
| |
| |
| |
Types | |
| |
| |
| |
Primitive types | |
| |
| |
| |
Built-in primitive types | |
| |
| |
| |
Defined primitive types | |
| |
| |
| |
Discrete primitive types | |
| |
| |
| |
Composite types | |
| |
| |
| |
Cartesian products, structures, and records | |
| |
| |
| |
Mappings, arrays, and functions | |
| |
| |
| |
Disjoint unions, discriminated records, and objects | |
| |
| |
| |
Recursive types | |
| |
| |
| |
Lists | |
| |
| |
| |
Strings | |
| |
| |
| |
Recursive types in general | |
| |
| |
| |
Type systems | |
| |
| |
| |
Static vs dynamic typing | |
| |
| |
| |
Type equivalence | |
| |
| |
| |
The Type Completeness Principle | |
| |
| |
| |
Expressions | |
| |
| |
| |
Literals | |
| |
| |
| |
Constructions | |
| |
| |
| |
Function calls | |
| |
| |
| |
Conditional expressions | |
| |
| |
| |
Iterative expressions | |
| |
| |
| |
Constant and variable accesses | |
| |
| |
| |
Implementation notes | |
| |
| |
| |
Representation of primitive types | |
| |
| |
| |
Representation of Cartesian products | |
| |
| |
| |
Representation of arrays | |
| |
| |
| |
Representation of disjoint unions | |
| |
| |
| |
Representation of recursive types | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Variables and storage | |
| |
| |
| |
Variables and storage | |
| |
| |
| |
Simple variables | |
| |
| |
| |
Composite variables | |
| |
| |
| |
Total vs selective update | |
| |
| |
| |
Static vs dynamic vs flexible arrays | |
| |
| |
| |
Copy semantics vs reference semantics | |
| |
| |
| |
Lifetime | |
| |
| |
| |
Global and local variables | |
| |
| |
| |
Heap variables | |
| |
| |
| |
Persistent variables | |
| |
| |
| |
Pointers | |
| |
| |
| |
Pointers and recursive types | |
| |
| |
| |
Dangling pointers | |
| |
| |
| |
Commands | |
| |
| |
| |
Skips | |
| |
| |
| |
Assignments | |
| |
| |
| |
Proper procedure calls | |
| |
| |
| |
Sequential commands | |
| |
| |
| |
Collateral commands | |
| |
| |
| |
Conditional commands | |
| |
| |
| |
Iterative commands | |
| |
| |
| |
Expressions with side effects | |
| |
| |
| |
Command expressions | |
| |
| |
| |
Expression-oriented languages | |
| |
| |
| |
Implementation notes | |
| |
| |
| |
Storage for global and local variables | |
| |
| |
| |
Storage for heap variables | |
| |
| |
| |
Representation of dynamic and flexible arrays | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Bindings and scope | |
| |
| |
| |
Bindings and environments | |
| |
| |
| |
Scope | |
| |
| |
| |
Block structure | |
| |
| |
| |
Scope and visibility | |
| |
| |
| |
Static vs dynamic scoping | |
| |
| |
| |
Declarations | |
| |
| |
| |
Type declarations | |
| |
| |
| |
Constant declarations | |
| |
| |
| |
Variable declarations | |
| |
| |
| |
Procedure definitions | |
| |
| |
| |
Collateral declarations | |
| |
| |
| |
Sequential declarations | |
| |
| |
| |
Recursive declarations | |
| |
| |
| |
Scopes of declarations | |
| |
| |
| |
Blocks | |
| |
| |
| |
Block commands | |
| |
| |
| |
Block expressions | |
| |
| |
| |
The Qualification Principle | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Procedural abstraction | |
| |
| |
| |
Function procedures and proper procedures | |
| |
| |
| |
Function procedures | |
| |
| |
| |
Proper procedures | |
| |
| |
| |
The Abstraction Principle | |
| |
| |
| |
Parameters and arguments | |
| |
| |
| |
Copy parameter mechanisms | |
| |
| |
| |
Reference parameter mechanisms | |
| |
| |
| |
The Correspondence Principle | |
| |
| |
| |
Implementation notes | |
| |
| |
| |
Implementation of procedure calls | |
| |
| |
| |
Implementation of parameter mechanisms | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Advanced Concepts | |
| |
| |
| |
Data abstraction | |
| |
| |
| |
Program units, packages, and encapsulation | |
| |
| |
| |
Packages | |
| |
| |
| |
Encapsulation | |
| |
| |
| |
Abstract types | |
| |
| |
| |
Objects and classes | |
| |
| |
| |
Classes | |
| |
| |
| |
Subclasses and inheritance | |
| |
| |
| |
Abstract classes | |
| |
| |
| |
Single vs multiple inheritance | |
| |
| |
| |
Interfaces | |
| |
| |
| |
Implementation notes | |
| |
| |
| |
Representation of objects | |
| |
| |
| |
Implementation of method calls | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Generic abstraction | |
| |
| |
| |
Generic units and instantiation | |
| |
| |
| |
Generic packages in ADA | |
| |
| |
| |
Generic classes in C++ | |
| |
| |
| |
Type and class parameters | |
| |
| |
| |
Type parameters in ADA | |
| |
| |
| |
Type parameters in C++ | |
| |
| |
| |
Class parameters in JAVA | |
| |
| |
| |
Implementation notes | |
| |
| |
| |
Implementation of ADA generic units | |
| |
| |
| |
Implementation of C++ generic units | |
| |
| |
| |
Implementation of JAVA generic units | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Type systems | |
| |
| |
| |
Inclusion polymorphism | |
| |
| |
| |
Types and subtypes | |
| |
| |
| |
Classes and subclasses | |
| |
| |
| |
Parametric polymorphism | |
| |
| |
| |
Polymorphic procedures | |
| |
| |
| |
Parameterized types | |
| |
| |
| |
Type inference | |
| |
| |
| |
Overloading | |
| |
| |
| |
Type conversions | |
| |
| |
| |
Implementation notes | |
| |
| |
| |
Implementation of parametric polymorphism | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Control flow | |
| |
| |
| |
Sequencers | |
| |
| |
| |
Jumps | |
| |
| |
| |
Escapes | |
| |
| |
| |
Exceptions | |
| |
| |
| |
Implementation notes | |
| |
| |
| |
Implementation of jumps and escapes | |
| |
| |
| |
Implementation of exceptions | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Concurrency | |
| |
| |
| |
Why concurrency? | |
| |
| |
| |
Programs and processes | |
| |
| |
| |
Problems with concurrency | |
| |
| |
| |
Nondeterminism | |
| |
| |
| |
Speed dependence | |
| |
| |
| |
Deadlock | |
| |
| |
| |
Starvation | |
| |
| |
| |
Process interactions | |
| |
| |
| |
Independent processes | |
| |
| |
| |
Competing processes | |
| |
| |
| |
Communicating processes | |
| |
| |
| |
Concurrency primitives | |
| |
| |
| |
Process creation and control | |
| |
| |
| |
Interrupts | |
| |
| |
| |
Spin locks and wait-free algorithms | |
| |
| |
| |
Events | |
| |
| |
| |
Semaphores | |
| |
| |
| |
Messages | |
| |
| |
| |
Remote procedure calls | |
| |
| |
| |
Concurrent control abstractions | |
| |
| |
| |
Conditional critical regions | |
| |
| |
| |
Monitors | |
| |
| |
| |
Rendezvous | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Paradigms | |
| |
| |
| |
Imperative programming | |
| |
| |
| |
Key concepts | |
| |
| |
| |
Pragmatics | |
| |
| |
| |
A simple spellchecker | |
| |
| |
| |
Case study: C | |
| |
| |
| |
Values and types | |
| |
| |
| |
Variables, storage, and control | |
| |
| |
| |
Bindings and scope | |
| |
| |
| |
Procedural abstraction | |
| |
| |
| |
Independent compilation | |
| |
| |
| |
Preprocessor directives | |
| |
| |
| |
Function library | |
| |
| |
| |
A simple spellchecker | |
| |
| |
| |
Case study: Ada | |
| |
| |
| |
Values and types | |
| |
| |
| |
Variables, storage, and control | |
| |
| |
| |
Bindings and scope | |
| |
| |
| |
Procedural abstraction | |
| |
| |
| |
Data abstraction | |
| |
| |
| |
Generic abstraction | |
| |
| |
| |
Separate compilation | |
| |
| |
| |
Package library | |
| |
| |
| |
A simple spellchecker | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Object-oriented programming | |
| |
| |
| |
Key concepts | |
| |
| |
| |
Pragmatics | |
| |
| |
| |
Case study: C++ | |
| |
| |
| |
Values and types | |
| |
| |
| |
Variables, storage, and control | |
| |
| |
| |
Bindings and scope | |
| |
| |
| |
Procedural abstraction | |
| |
| |
| |
Data abstraction | |
| |
| |
| |
Generic abstraction | |
| |
| |
| |
Independent compilation and preprocessor directives | |
| |
| |
| |
Class and template library | |
| |
| |
| |
A simple spellchecker | |
| |
| |
| |
Case study: Java | |
| |
| |
| |
Values and types | |
| |
| |
| |
Variables, storage, and control | |
| |
| |
| |
Bindings and scope | |
| |
| |
| |
Procedural abstraction | |
| |
| |
| |
Data abstraction | |
| |
| |
| |
Generic abstraction | |
| |
| |
| |
Separate compilation and dynamic linking | |
| |
| |
| |
Class library | |
| |
| |
| |
A simple spellchecker | |
| |
| |
| |
Case study: Ada95 | |
| |
| |
| |
Types | |
| |
| |
| |
Data abstraction | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Concurrent programming | |
| |
| |
| |
Key concepts | |
| |
| |
| |
Pragmatics | |
| |
| |
| |
Case study: Ada95 | |
| |
| |
| |
Process creation and termination | |
| |
| |
| |
Mutual exclusion | |
| |
| |
| |
Admission control | |
| |
| |
| |
Scheduling away deadlock | |
| |
| |
| |
Case study: Java | |
| |
| |
| |
Process creation and termination | |
| |
| |
| |
Mutual exclusion | |
| |
| |
| |
Admission control | |
| |
| |
| |
Implementation notes | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Functional programming | |
| |
| |
| |
Key concepts | |
| |
| |
| |
Eager vs normal-order vs lazy evaluation | |
| |
| |
| |
Pragmatics | |
| |
| |
| |
Case study: Haskell | |
| |
| |
| |
Values and types | |
| |
| |
| |
Bindings and scope | |
| |
| |
| |
Procedural abstraction | |
| |
| |
| |
Lazy evaluation | |
| |
| |
| |
Data abstraction | |
| |
| |
| |
Generic abstraction | |
| |
| |
| |
Modeling state | |
| |
| |
| |
A simple spellchecker | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Logic programming | |
| |
| |
| |
Key concepts | |
| |
| |
| |
Pragmatics | |
| |
| |
| |
Case study: Prolog | |
| |
| |
| |
Values, variables, and terms | |
| |
| |
| |
Assertions and clauses | |
| |
| |
| |
Relations | |
| |
| |
| |
The closed-world assumption | |
| |
| |
| |
Bindings and scope | |
| |
| |
| |
Control | |
| |
| |
| |
Input/output | |
| |
| |
| |
A simple spellchecker | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Scripting | |
| |
| |
| |
Pragmatics | |
| |
| |
| |
Key concepts | |
| |
| |
| |
Regular expressions | |
| |
| |
| |
Case study: Python | |
| |
| |
| |
Values and types | |
| |
| |
| |
Variables, storage, and control | |
| |
| |
| |
Bindings and scope | |
| |
| |
| |
Procedural abstraction | |
| |
| |
| |
Data abstraction | |
| |
| |
| |
Separate compilation | |
| |
| |
| |
Module library | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
| |
Conclusion | |
| |
| |
| |
Language selection | |
| |
| |
| |
Criteria | |
| |
| |
| |
Evaluation | |
| |
| |
Summary | |
| |
| |
Exercises | |
| |
| |
| |
Language design | |
| |
| |
| |
Selection of concepts | |
| |
| |
| |
Regularity | |
| |
| |
| |
Simplicity | |
| |
| |
| |
Efficiency | |
| |
| |
| |
Syntax | |
| |
| |
| |
Language life cycles | |
| |
| |
| |
The future | |
| |
| |
Summary | |
| |
| |
Further reading | |
| |
| |
Exercises | |
| |
| |
Bibliography | |
| |
| |
Glossary | |
| |
| |
Index | |