Vocabulary and representationThe representation of symbols in terms of characters depends on the underlying character set. The ASCII set is used in this reference text, and the following lexical rules must be observed. Blanks must not occur within symbols (except in strings). Blanks and line breaks are ignored unless they are essential to separate two consecutive symbols. IdentifiersIdentifiers are sequences of letters and digits. The first character must be a letter. ident = letter {letter | digit} Examples: x scan Modula ETH GetSymbol firstLetter NumbersNumbers are (unsigned) integers or real numbers. Integers are sequences of digits. If the number is followed by the letter B, it is taken as an octal number; if it is followed by the letter H, it is taken as a hexadecimal number; if it is followed by the letter C, it denotes the character with the given (octal) ordinal number (and is of type CHAR). An integer i in the range 0 <= i <= MaxInt can be considered as either of type INTEGER or CARDINAL; if it is in the range MaxInt < i <= MaxCard, it is of type CARDINAL. For 16-bit computers: MaxInt = 32767, MaxCard = 65535. A real number always contains a decimal point. Optionally it may also contain a decimal scale factor. The letter E is pronounced as "ten to the power of". A real number is of type REAL. number = integer | real. integer = digit {digit} | octalDigit {octalDigit} ("B" | "C") | digit {hexDigit} "H". real = digit {digit} "." {digit} [ScaleFactor]. ScaleFactor = "E" ["+"|"-"] digit {digit}. hexDigit = digit | "A" | "B" | "C" | "D" | "E" | "F". digit = octalDigit | "8" | "9". | octalDigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7". Examples: 1980 3764B 7BCH 33C 12.3 45.67E 8 StringsStrings are sequences of characters enclosed in quote marks. Both double quotes and single quotes (apostrophes) may be used as quote marks. However, the opening and closing marks must be the same character, and this character cannot occur within the string. A string must not extend over the end of a line. string = '"' {character} '"' | "'" {character} "'" A string consisting of n characters is of type ARRAY [0..n-1] OF CHAR Examples: "MODULA" "Don't worry!" 'codeword"Barbarossa"' Operators and delimitersOperators and delimiters are the special characters, character pairs, or reserved words listed below. These reserved words consist exclusively of capital letters and must not be used in the role of identifiers. The symbols # and <> are synonyms, and so are &, AND, and ~, NOT. + = AND FOR QUALIFIED - # ARRAY FORWARD RECORD * < BEGIN FROM REPEAT / > BY IF REM := <> CASE IMPLEMENTATION RETRY & <= CONST IMPORT RETURN . >= DEFINITION IN SET , .. DIV LOOP THEN ; : DO MOD TO ( ) ELSE MODULE TYPE [ ] ELSIF NOT UNTIL { } END OF VAR ^ | EXCEPT OR WHILE ~ EXIT PACKEDSET WITH EXPORT POINTER FINALLY PROCEDURE Additional reserved words defined by the ISO generics language extension GENERIC Additional reserved words defined by the ISO object oriented language extension AS INHERIT TRACED ABSTRACT OVERRIDE UNSAFEGUARDED CLASS READONLY GUARD REVEAL CommentsComments may be inserted between any two symbols in a program. They are arbitrary character sequences opened by the bracket (* and closed by *). Comments may be nested, and they do not affect the meaning of a program. Source:
|