Skip to content

Syntax Diagrams

Benjamin Kowarsch edited this page Aug 23, 2017 · 26 revisions

Non-Terminals

Start Symbol

compilationUnit

Compilation Unit

Definition Module Syntax

definitionModule

Definition Module

moduleIdent

Module Identifier

import

Import

libIdent

Library Identifier

ident

Identifier

qualident

Qualified Identifier

identList

Identifier List

definition

Definition

constDefinition

Constant Definition

constExpression

Constant Expression

typeDefinition

Type Definition

type

Type

aliasType

Alias Type

typeIdent

Type Identifier

derivedType

Derived Type

subrangeType

Subrange Type

range

Range

lowerBound

Lower Bound

upperBound

Upper Bound

countableType

Ordinal Or Scalar Type

enumType

Enumeration Type

enumTypeToExtend

Enumeration Type To Extend

enumTypeIdent

Enumeration Type Identifier

setType

Set Type

arrayType

Array Type

valueCount

Value Count

recordType

Record Type

recTypeToExtend

Record Type To Extend

fieldList

Field List

pointerType

Pointer Type

procedureType

Procedure Type

formalType

Formal Type

nonAttrFormalType

Non-Attributed Formal Type

returnedType

Formal Type

simpleFormalType

Simple Formal Type

castingFormalType

Casting Formal Type

variadicFormalType

Variadic Formal Type

procedureHeader

Procedure Header

procedureSignature

Procedure Signature

formalParams

Formal Parameters

Implementation and Program Module Syntax

implOrPrgmModule

Implementation Module

privateImport

Private Import

block

Block

declaration

Declaration

aliasDeclaration

Alias Declaration

namedAliasDecl

Named Alias Declaration

aliasName

Alias Name

qualifiedName

Qualified Name

qualifiedWildcard

Qualified Wildcard

wildcardAliasDecl

Wildcard Alias Declaration

typeDeclaration

Type Declaration

indeterminateType

Indeterminate Type

indeterminateField

Indeterminate Field

varOrFieldDeclaration

Variable Or Field Declaration

anonType

Anononymous Type

statementSequence

Statement Sequence

statement

Statement

emptyStatement

Empty Statement

memMgtOperation

Memory Management Operation

initSize

Initialisation Size

updateOrProcCall

Update Or Procedure Call

incOrDecSuffix

Increment Or Decrement Suffix

returnStatement

Return Statement

copyStatement

COPY Statement

readStatement

READ Statement

writeStatement

WRITE Statement

chan

Channel

outputArgs

Output Arguments

formattedArgs

Formatted Arguments

fmtStr

Format String

unformattedArgs

Unformatted Arguments

ifStatement

IF Statement

boolExpression

Boolean Expression

caseStatement

CASE Statement

case

Case

caseLabels

Case Labels

loopStatement

LOOP Statement

whileStatement

WHILE Statement

repeatStatement

REPEAT Statement

forStatement

FOR Statement

forLoopVariants

FOR Loop Variants

index, value

Index Or Value

ascOrDesc

Ascender Or Descender

iterableExpr

Iterable Expr

ordinalRange

Ordinal Range

firstValue, lastValue

First Value/Last Value

ordinalType

Ordinal Type

designator

Designator

designatorTail

Designator Tail

deref

Dereference

fieldSelector

Field Selector

subscriptOrSlice

Subscript Or Slice

expressionList

Expression List

expression

Expression

operL1

Level-1 Operator

simpleExpression

Simple Expression

operL2

Level-2 Operator

concatOp

Concatenation Operator

setDiffOp

Set Difference Operator

term

Term

operL3

Level-3 Operator

simpleTerm

Simple Term

factor

Factor

typeConvOp

Type Conversion Operator

simpleFactor

Simple Factor

designatorOrFuncCall

Designator Or Function Call

structuredValue

Structured Value

valueComponent

Value Component

runtimeExpression

Runtime Expression

To Do Lists

toDoList

TO DO List

trackingRef

Tracking Reference

issueId

Issue ID

wholeNumber

Whole Number

taskToDo

Task To Do

description

Description

weight, estimatedHours

Weight/Estimated Hours

Terminals

StdIdent

Standard Identifier
 △ Standard identifier syntax for Modula-2, default

LetterOrDigit

Letter Or Digit

ForeignIdent

Foreign Identifier
 △ Additional identifier syntax for interfacing to foreign APIs, enabled by FFI pragma or compiler switch

ForeignIdentTail

Foreign Identifier Tail

NumberLiteral

Number Literal

DecimalNumberTail

Decimal Number Tail

RealNumberTail

Real Number Tail

DigitSeq

Digit Sequence

DigitGroup

Digit Group

Base2DigitSeq

Base-2 Digit Sequence

Base2DigitGroup

Base-2 Digit Group

Base16DigitSeq

Base-16 Digit Sequence

Base16DigitGroup

Base-16 Digit Group

Digit

Digit

Base2Digit

Base-2 Digit

Base16Digit

Base-16 Digit

StringLiteral

String Literal

SingleQuotedString

Single-Quoted String

DoubleQuotedString

Double-Quoted String

QuotableCharacter

Quotable Character

Letter

Letter

NonAlphaNumQuotable

Non-Alpha-Numeric Quotable 1 Non-Alpha-Numeric Quotable 2 Non-Alpha-Numeric Quotable 3

EscapedCharacter

Escaped Character

Ignore Symbols

Whitespace

Whitespace

LineComment

Line Comment

BlockComment

Block Comment

CommentCharacter

Comment Character

EndOfLine

End Of Line Marker

Debugging Aid

Not part of the language specification

DisabledCodeSection

Disabled Code Section

AnyPrintable

Any Printable Character

Clone this wiki locally