Previous | Table of Contents | Next |
Care should be taken, when using colons and semicolons in the same sentence, that the reader understands how far the force of each sign carries.
Robert Graves and Alan Hodge
This section includes an overview of the language syntax.
AND | DO | FROM | NOT | REPEAT | UNTIL |
ANY | ELSE | GENERIC | OBJECT | RETURN | UNTRACED |
ARRAY | ELSIF | IF | OF | REVEAL | VALUE |
AS | END | IMPORT | OR | ROOT | VAR |
BEGIN | EVAL | IN | OVERRIDES | SET | WHILE |
BITS | EXCEPT | INTERFACE | PROCEDURE | THEN | WITH |
BRANDED | EXCEPTION | LOCK | RAISE | TO | |
BY | EXIT | LOOP | RAISES | TRY | |
CASE | EXPORTS | METHODS | READONLY | TYPE | |
CONST | FINALLY | MOD | RECORD | TYPECASE | |
DIV | FOR | MODULE | REF | UNSAFE | |
ABS | CARDINAL | FIRST | LONGREAL | NIL | SUBARRAY |
ADDRESS | CEILING | FLOAT | LOOPHOLE | NULL | TEXT |
ADR | CHAR | FLOOR | MAX | NUMBER | TRUE |
ADRSIZE | DEC | INC | MIN | ORD | TRUNC |
BITSIZE | DISPOSE | INTEGER | MUTEX | REAL | TYPECODE |
BOOLEAN | EXTENDED | ISTYPE | NARROW | REFANY | VAL |
BYTESIZE | FALSE | LAST | NEW | ROUND | |
+ | < | # | = | ; | .. | : | ||||||||||||||||||||
- | > | { | } | | | := | <:
*
| <=
| (
| )
| ^
| ,
| =>
| /
| >=
| [
| ]
| .
| &
| |
A comment is an arbitrary character sequence opened by (* and closed by *). Comments can be nested and can extend over more than one line.
A pragma is an arbitrary character sequence opened by <* and closed by *>. Pragmas can be nested and can extend over more than one line. Pragmas are hints to the implementation; they do not affect the language semantics.
We recommend supporting the two pragmas <*INLINE*> and <*EXTERNAL*>. The pragma <*INLINE*> precedes a procedure declaration to indicate that the procedure should be expanded at the point of call. The pragma <*EXTERNAL N:L*> precedes an interface or a declaration in an interface to indicate that the entity it precedes is implemented by the language L, where it has the name N. If :L is omitted, then the implementations default external language is assumed. If N is omitted, then the external name is determined from the Modula-3 name in some implementation-dependent way.
We use the following notation for defining syntax:
X Y X followed by Y X|Y X or Y [X] X or empty {X} A possibly empty sequence of Xs X&Y X or Y or X Y
Followed by has greater binding power than | or &; parentheses are used to override this precedence rule. Non-terminals begin with an uppercase letter. Terminals are either keywords or quoted operators. The symbols Ident, Number, TextLiteral, and CharLiteral are defined in the token grammar. Each production is terminated by a period. The syntax does not reflect the restrictions that revelations and exceptions can be declared only at the top level; nor does it include explicit productions for NEW, INC, and DEC, which parse like procedure calls.
Previous | Table of Contents | Next |