Appendix 2 Syntax Diagrams

The syntax diagrams in this section are more complete and expand upon those given in the body of the text. They are intended as visual aids to understanding the correct structure of Modula-2 programming constructions, but they do not constitute an official or complete definition of the language. For that, see the Modula-2 Draft Standard.

A2.1 Lexis

identifier

identifier list

constant literal

numeric literal whole number literal

decimal number digit

octal digit octal number

real literal

scale factor

A2.2 Syntax

The numbering in this section (after the A2.2) corresponds to that of the Modula-2 ISO Standard Annex C.

A2.2.1 Programs, Program Modules, and Separate Modules

A2.2.1.1 Programs and Compilation Modules

compilation module

A2.2.1.2 Program Modules

program module

module identifier protection

protection expression

A2.2.1.3 Definition Module

definition module

A2.2.1.4 Implementation Modules

A2.2.1.4.1 Sourced Implementation Modules

implementation module

A2.2.1.5 Import Lists

import lists

A2.2.1.5.1 Import List

import list

A2.2.1.5.2 Simple Import

simple import

A2.2.1.5.3 Unqualified Import

unqualified import

A2.2.1.6 Export Lists

export list

A2.2.1.6.1 Unqualified Exports

unqualified export

A2.2.1.6.2 Qualified Exports

qualified export

A2.2.2 Definitions and Declarations

A2.2.2.1 Qualified Identifiers

qualified identifier

A2.2.2.2 Definitions

definitions

definition

procedure heading

A2.2.2.2.1 Type Definitions

type definition opaque type definition

A2.2.2.2.2 Proper Procedure Headings

proper procedure heading

formal parameters

formal parameter list

A2.2.2.2.3 Function Procedure Headings

function procedure heading

function result type

A2.2.2.2.4 Formal Parameters

formal parameter

A2.2.2.2.4.1 Value Parameters

value parameter specification

A2.2.2.2.4.2 Variable Parameters

variable parameter specification

A2.2.2.3 Declarations

declarations

declaration

A2.2.2.4 Constant Declarations

constant declaration

A2.2.2.5 Type Declarations

type declaration

A2.2.2.6 Variable Declarations

variable declaration

variable identifier list

machine address value of address type

A2.2.2.7 Procedure Declarations

procedure declaration

A2.2.2.8 Proper Procedure Declarations

proper procedure declarations

procedure identifier

A2.2.2.8.1 Function Procedure Declarations

function procedure declaration

A2.2.2.9 Local Module Declarations

local module declaration

A2.2.3 Types

type denoter ordinal type denoter

A2.2.3.1 Type Identifiers

type identifier ordinal type identifier

A2.2.3.2 New Types

new type new ordinal type

A2.2.3.2.1 Enumeration Types

enumeration type identifier list

A2.2.3.2.2 Subrange Types

subrange type

range type

A2.2.3.2.3 Set Types

set type

base type

A2.2.3.2.4 Packedset Types

packedset type

A2.2.3.2.5 Pointer Types

pointer type

bound type

A2.2.3.2.6 Procedure Types

procedure type

proper procedure type

function procedure type

formal parameter type list formal parameter type

variable formal type value formal type

A2.2.3.2.7 Formal Types

formal type

open array formal type

A2.2.3.2.8 Array Types

array type

index type component type

A2.2.3.2.9 Record Types

record type

field list fields

fixed fields

field type

variant fields

tag identifier tag type

variant list

variant else part

variant

variant label list

variant label

A2.2.4 Blocks

A2.2.4.1 Proper Procedure Blocks

proper procedure block

procedure body

A2.2.4.2 Function Procedure Blocks

function procedure block

function body

A2.2.4.3 Module Blocks

module block

module body

initialization body

finalization body

A2.2.4.4 Block Bodies and Exception Handling

block body

normal part exceptional part

A2.2.5 Statements

statement

A2.2.5.1 Statement Sequences

statement sequence

A2.2.5.2 Empty Statements

empty statement



A2.2.5.3 Assignment Statements

assignment statement

A2.2.5.4 Procedure Calls

procedure call

procedure designator

A2.2.5.5 Return Statements

return statement

A2.2.5.5.1 Simple Return Statements

simple return statement

A2.2.5.5.2 Function Return Statements

function return statement

A2.2.5.6 Retry Statements

retry statement

A2.2.5.7 With Statements

with statement

record designator

A2.2.5.8 If Statements

if statement

guarded statements

if else part boolean expression

A2.2.5.9 Case Statements

case statement

case selector

case list

case else part

A2.2.5.9.1 Case Alternatives

case alternative

case label list

case label

A2.2.5.10 While Statements

while statment

A2.2.5.11 Repeat Statements

repeat statment

A2.2.5.12 Loop Statements

loop statement

A2.2.5.13 Exit Statements

exit statement

control variable identifier initial value

final value step size

A2.2.6 Variable Designator

variable designator

A2.2.6.1 Entire Designators

entire designator

A2.2.6.2 Indexed Designators

indexed designator

array variable designator index expression

A2.2.6.3 Selected Designators

selected designator

record variable designator field identifier

A2.2.6.4 Dereferenced Designators

dereferenced designator pointer variable designator

A2.2.7 Expressions

expression

simple expression

term

factor

ordinal expression

A2.2.7.1 Infix Expressions

relational operator term operator

factor operator

A2.2.7.2 Value Designators

value designator

A2.2.7.2.1 Entire Value

entire value

A2.2.7.2.2 Indexed Values

indexed value

array value

A2.2.7.2.3 Selected Values

selected value

record value

A2.2.7.2.4 Dereferenced Values

dereferenced value pointer value

A2.2.7.3 Function Calls

function call

function designator

A2.2.7.4 Value Constructors

value constructor

A2.2.7.4.1 Array Constructors

array constructor

array type identifier

array constructed value

repeated structure component

repetition factor

structure component

A2.2.7.4.2 Record Constructors

record constructor

record type identifier

record constructed value

A2.2.7.4.3 Set Constructors

set constructor

set type identifier

set constructed value member

interval

singleton

A2.2.7.5 Constant Literals

constant literal

A2.2.7.6 Constant Expressions

constant expression

A2.2.8 Parameters and Arguments Binding

A2.2.8.1 Actual Parameters

actual parameters

actual parameter list actual parameter

A2.2.8.2 Special Parameters

A2.2.8.2.1 Type Parameters

type parameter


Contents