1. Identifiers are sequences of letters and digits. The first character must be a letter.
ident = letter {letter | digit}.
Examples:
x2. Numbers are (unsigned) integer or real constants. The type of an integer constant is the minimal type to which the constant value belongs (see 6.1). If the constant is specified with the suffix H, the representation is hexadecimal otherwise the representation is decimal.
Scan
Oberon2
GetSymbol
firstLetter
A real number always contains a decimal point. Optionally it may also contain a decimal scale factor. The letter E (or D) means "times ten to the power of". A real number is of type REAL, unless it has a scale factor containing the letter D. In this case it is of type LONGREAL.
number = integer | real.Examples:
integer = digit {digit} | digit {hexDigit} "H".
real = digit {digit} "." {digit} [ScaleFactor].
ScaleFactor = ("E" | "D") ["+" | "-"] digit {digit}.
hexDigit = digit | "A" | "B" | "C" | "D" | "E" | "F".
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9".
1991 INTEGER 19913. Character constants are denoted by the ordinal number of the character in hexadecimal notation followed by the letter X.
0DH SHORTINT 13
12.3 REAL 12.3
4.567E8 REAL 456700000
0.57712566D-6 LONGREAL 0.00000057712566
character = digit {hexDigit} "X".
4. Strings are sequences of characters enclosed in single (') or
double (") quote marks. The opening quote must be the same as the closing
quote and must not occur within the string. The number of characters in a
string is called its length. A string of length 1 can be used wherever
a character constant is allowed and vice versa.
string = ' " ' {char} ' " ' | " ' " {char} " ' ".
Examples:
"Oberon-2"5. Operators and delimiters are the special characters, character pairs, or reserved words listed below. The reserved words consist exclusively of capital letters and cannot be used as identifiers.
"Don't worry!"
"x"
+ := ARRAY IMPORT RETURN6. Comments 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. They do not affect the meaning of a program.
- ^ BEGIN IN THEN
* = BY IS TO
/ # CASE LOOP TYPE
~ < CONST MOD UNTIL
& > DIV MODULE VAR
. <= DO NIL WHILE
, >= ELSE OF WITH
; .. ELSIF OR
| : END POINTER
( ) EXIT PROCEDURE
[ ] FOR RECORD
{ } IF REPEAT