Part 1
Compiler

Table of Contents

Use
1.1 General
1.2 The Command Line
1.3 Files
1.4 Compiler Directives
1.5 Compiler Errors
1.6 Built-In Version-Compatibility Check
1.7 Linking Modula-2 Programs
1.7.1 Command Line Tools
1.7.2 Cocoa Applications
1.7.2.1 Simple Project D3Cocoa
1.7.2.2 Integration in a Swift macOS application
1.7.2.3 Integration in an Objective-C macOS application
1.7.2.4 Integration in a Swift iOS application
1.7.2.5 Document Based Project PlotFun Written in Objective C
1.7.2.6 Comlex GUI Example Project Dungeon Written in Swift
1.7.3 Compiling and Linking Applications and Tools when using the C Back End
1.7.4 Building Universal Binaries
1.8 Environment Variables and Path Settings
1.9 Xcode Integration
1.9.1 Setting up Xcode Projects for p1 Modula-2
1.9.1.1 Setting up a Very Simple New Project
1.9.1.2 Setting up a Simple New Project with source subfolders
1.9.1.3 Setting up a Typical Project
1.9.2 Error Messages and Path Names
1.9.3 Making Modula-2 source files known to Xcode
Language Definition as per ISO 10514
2.1 Type Classification
2.2 Type Compatibility
2.3 Changes with Respect to Programming in Modula-2
2.3.1 Operations on Whole Numbers
2.3.2 Control Variables of "FOR" Statements
2.3.3 Packed Sets
2.3.4 Procedure Constants
2.3.5 String Concatenation
2.3.6 Complex Numbers
2.3.7 Pragmas
2.3.8 Multidimensional Open Arrays
2.3.9 Miscellaneous
2.4 Value Constructors
2.4.1 Set Constructors
2.4.2 Array Constructors
2.4.3 Record Constructors
2.4.4 Compound Value Constructors
2.5 Standard Procedures and Functions
2.5.1 Standard Functions
2.5.2 Standard Procedures
2.6 Termination Part
2.6.1 Syntax
2.6.2 Execution
2.6.2.1 Execution in Global Modules
2.6.2.2 Execution in Local Modules
2.6.2.3 Premature Termination
2.6.3 Termination and Coroutines
2.7 Exception Handling
2.7.1 Basic Functionality
2.7.2 The Exception Handler
2.7.2.1 Structure
2.7.2.2 Continuation of the Program
2.7.2.3 Information Exchange
2.7.3 Definition and Analysis of Exceptions
2.7.3.1 Definition
2.7.3.2 Triggering an Exception
2.7.3.3 Analysis of an Exception Condition
2.7.3.4 Exception Conditions in Libraries
2.7.4 Concluding Remarks Regarding Exception Handling
2.8 The Module "SYSTEM"
2.8.1 The Pseudo Definition-Module "SYSTEM"
2.8.2 Description
2.9 The Module "COROUTINES"
2.9.1 The Pseudo Definition-Module "COROUTINES"
2.9.2 Description
2.10 The Module "EXCEPTIONS"
2.10.1 The Pseudo Definition-Module "EXCEPTIONS"
2.10.2 Description
2.11 The Module "M2EXCEPTION"
2.11.1 The Pseudo Definition-Module "M2EXCEPTION"
2.11.2 Description
2.11.3 Predefined Exception Conditions
2.12 The Module "TERMINATION"
2.12.1 The Pseudo Definition-Module "TERMINATION"
2.12.2 Description
Extensions to the Language by ISO
3.1 Objects
3.1.1 Class Declaration
3.1.2 Kinds of Classes
3.1.3 Use of Object Variables
3.1.4 The Module "M2OOEXCEPTION"
3.1.4.1 The Pseudo Definition Module "M2OOEXCEPTION"
3.1.4.2 Description
3.1.4.3 Exception Conditions for "OO-Extensions"
3.1.5 The Module "GARBAGECOLLECTION"
3.1.5.1 The Pseudo Definition Module "GARBAGECOLLECTION"
3.1.5.2 Description
3.2 Generics
3.2.1 Generic Modules
3.2.2 Refining as Definition / Implementation Module
3.2.3 Refinement as Local Module.
Extensions to the Language in p1 Modula-2
4.1 Extensions to the Module SYSTEM
4.1.1 Extensions to the Pseudo Definition-Module
4.1.2 Additional Constants
4.1.3 Additional Data Types
4.1.3.1 Types with Universally Fixed Size
4.1.3.2 STR255
4.1.3.3 BCD
4.1.4 Additional Functions and Procedures
4.1.5 Additional Features of Predefined Functions and Procedures
4.2 Pragmas
4.3 Conditional Compilation
4.3.1 Syntax of Conditional Compilation Directives
4.3.2 Compile-Time Variables
4.3.3 Examples
4.4 Interfacing to Other Languages
4.4.1 Calling Foreign Code Modules from Modula-2
4.4.1.1 Interfacing to C
4.4.1.2 Interfacing to Pascal
4.4.2 Calling Modula-2 Procedures from Other Languages
4.4.2.1 Calling Conventions
4.4.2.2 Runtime- and module initalization
4.5 Dynamic Arrays
4.5.1 Declaration of the Data Structure
4.5.2 Allocation / Deallocation of Storage
4.5.3 Operations on Dynamic Arrays
4.6 Further Extensions
Implementation
5.1 Implementation Documentation as per ISO 10514
5.1.1 General Information
5.1.2 Implementation-Defined Factors
5.1.3 Constant Expressions
5.2 Restrictions
5.3 Implementation Details
5.3.1 Size and Alignment of Modula-2 Types
5.3.2 Parameter Passing
5.3.3 Reference Parameters
5.3.4 Open Arrays
5.3.5 Value of "NIL" / "EMTPY" /  Undefined Variables
5.3.6 Arrangement of Bits in SET Variables
5.3.7 Arrangement of Bits in PACKEDSET Variables
5.3.8 Register Usage
5.3.8.1 Arm
5.3.8.2 Intel
5.3.9 Generation of Floating-Point Code
The Modula-2 Run-Time System
6.1 Initialization Process
6.2 Run-Time Errors
6.2.1 Details for Command Line Tools
6.2.2 Details for Applications
6.2.3 Handling of KILL Signals
6.3 Global Data Structures
6.3.1 Procedure Stack
6.3.1.1 Arm Runtime
6.3.1.2 Intel Runtime
6.3.2 Global Variables
6.3.3 Process Descriptor
6.3.4 Object Organization
6.3.5 Organization of Dynamic Arrays
Appendix I: The Syntax of p1 Modula-2
I.1 Lexical Structure
I.2 Syntax
Appendix II: Differences Between This and Previous Implementations
II.1 The Differences to V7.x
II.2 Conversion Tips

start page start page chapter 1 (compiler)