I Moving to Modula-2.- 1 Modula-2 and Pascal.- 1.1 Modula-2 and Pascal.- 1.2 Modules.- 1.3 IMPORT and EXPORT.- 1.4 An Overview of the InOut global MODULE.- 1.5 Example — The Underline Filter.- 1.6 Syntax Diagrams.- 1.6.1 Sequence.- 1.6.2 Optional Paths.- 1.6.3 Alternative Paths.- 1.6.4 Repetitive Paths.- 1.7 The Elements of a Modula-2 Program.- 1.7.1 Identifiers.- 1.7.2 Modula-2 Reserved Words and Standard Identifiers.- 2 Data in Modula-2.- 2.1 Declarations and Variables.- 2.2 Eight Useful Data TYPES.- 2.2.1 Boolean.- 2.2.2 Integer.- 2.2.3 Cardinal.- 2.2.4 Char.- 2.2.5 Real.- 2.2.6 Long Data TYPES.- 2.3 TYPE Compatibility and TYPE Transfer Functions.- 2.3.1 INTEGERS and CARDINALS.- 2.3.2 REALS and CARDINALS.- 2.3.3 CHARS and CARDINALS.- 2.4 Assignments, Expressions, and Precedence.- 2.5 Constants.- 2.5.1 Named Constants.- 3 Control Flow in Modula-2.- 3.1 The IF Statement.- 3.2 The CASE Statement.- 3.3 The WHILE Statement.- 3.4 The REPEAT Statement.- 3.5 The FOR Statement.- 3.6 The LOOP and EXIT Statements.- 4 Procedures.- 4.1 MODULES and PROCEDURES.- 4.2 Procedures.- 4.3 Variable and Value Parameters.- 4.4 Ordinary and Function PROCEDURES.- 4.5 The RETURN Statement.- 4.6 N Factorial.- 4.7 PROCEDURE Scope.- 4.8 Recursion.- 4.9 Example — A Desk Calculator.- 5 Arrays.- 5.1 TYPE Declarations.- 5.2 ARRAYS as PROCEDURE Parameters.- 5.3 Open ARRAY Parameters.- 5.4 Multiple ARRAY Dimensions.- 5.5 Subranges.- 5.6 String Variables.- 5.7 Example — Long Arithmetic.- II Modules.- 6 Local MODULES.- 6.1 Local MODULE Bodies.- 6.2 Static Variables.- 6.3 Example — The Sieve of Eratosthenes.- 7 Definition Modules.- 7.1 Definitions.- 7.1.1 Constant and Variable Definitions.- 7.1.2 TYPE Definitions.- 7.1.3 PROCEDURE Definitions.- 7.2 Hiding PROCEDURES — String Utilities Definition.- 7.3 Hiding Data — A Circular Buffer.- 8 Implementation Modules.- 8.1 Compilation.- 8.2 Strings Implementation.- 8.3 Circular Buffer Implementation.- 9 Common Global MODULES.- 9.1 InOut.- 9.2 RealInOut.- 9.3 Terminal.- 9.4 Streams.- 9.5 Files.- 9.6 MathLibO.- 9.7 LineDrawing.- 10 Desk Calculator with Variables and Assignments.- 10.1 Adding Variables to the Desk Calculator Program.- 10.2 Organizing the Desk Calculator.- 10.3 The CalcVariables MODULE.- 10.4 The CalcInput MODULE.- 10.5 The CalcStatement MODULE.- 10.6 The Calc2 Program.- III Advanced Data Types.- 11 Enumerations.- 11.1 VAL.- 11.1.1 Example — the Months Global MODULE.- 11.2 Example — Running a Maze.- 12 Sets.- 12.1 Bitsets.- 12.2 SET Operations.- 12.3 INCL and EXCL.- 12.4 Example — Packed BOOLEANS and the Sieve Revisited.- 13 Records.- 13.1 The WITH Statement.- 13.2 Example — Linked Lists.- 13.3 Variant RECORDS.- 13.4 Example — Breadth First Maze Search.- 14 Dynamic Data.- 14.1 Pointers.- 14.1.1 POINTER Assignment.- 14.1.2 Dereferencing.- 14.1.3 POINTER Comparison.- 14.2 ALLOCATE and DEALLOCATE.- 14.3 Example — Binary Trees.- 15 Procedure Variables.- 15.1 Example — The Quicksort.- IV Systems Programming.- 16 TYPE Relaxation.- 16.1 The SYSTEM MODULE.- 16.2 Word.- 16.3 Address.- 16.3.1 SIZE, TSIZE, and ADR.- 16.3.2 A Stack Storage System.- 16.4 TYPE Names as TYPE Transfer Functions.- 16.5 Example — Generic Quicksort.- 17 Programming Hardware.- 17.1 Located Variables.- 17.2 MODULE Priorities.- 18 Coroutines.- 18.1 Coroutines and Subroutines.- 18.2 PROCESS, NEWPROCESS, and TRANSFER.- 18.3 Example — The Polling Term Program.- 19 Device Drivers.- 19.1 Iotransfer.- 19.2 Example — A Clock Driver.- 19.3 Example — Timing a Spike Train.- 19.4 Example — The Interrupt driven Term Program.- Appendices.- I. Modula-2’s Reserved Words.- II. Modula-2’s Standard Identifiers.- III. Modula-2’s Standard Functions.- IV. Standard PROCEDURES from SYSTEM.- V. Standard Coroutine PROCEDURES.- VI. Legal Modula-2 Operations.- VII. Strict TYPE Compatibility.- VIII. Assignment TYPE Compatibility.- IX. The ASCII Character Set.- X. Implementation Notes.- XI. Syntax Diagrams.- Modules.- Procedures.- Types.- Declarations.- Constants.- Variables.- Operators.- Statements.