‘array’, ‘if’, ‘then’, ‘else’, ‘while’, ‘for’, ‘to’, ‘do’, ‘let’, ‘in’, ‘end’, ‘of’, ‘break’, ‘nil’, ‘function’, ‘var’, ‘type’, ‘import’ and ‘primitive’
The keywords ‘class’, ‘extends’, ‘method’ and ‘new’ are reserved for object-related constructions. They are valid keywords when the object extension of the language is enabled, and reserved words if this extension is disabled (i.e., they cannot be used as identifiers in object-less syntax).
‘,’, ‘:’, ‘;’, ‘(’, ‘)’, ‘[’, ‘]’, ‘{’, ‘}’, ‘.’, ‘+’, ‘-’, ‘*’, ‘/’, ‘=’, ‘<>’, ‘<’, ‘<=’, ‘>’, ‘>=’, ‘&’, ‘|’, and ‘:=’
Space and tabulations are the only white space characters supported. Both count as a single character when tracking locations.
End of lines are ‘\n\r’, and ‘\r\n’, and ‘\r’, and ‘\n’, freely intermixed.
The strings are ANSI-C strings: enclosed by ‘"’, with support for the following escapes:
control characters.
The character which code is num in octal. Valid character codes belong to an extended (8-bit) ASCII set, i.e. values between 0 and 255 in decimal (0 and 377 in octal). num is composed of exactly three octal characters, and any invalid value is a scan error.
The character which code is num in hexadecimal (upper case or lower case or mixed). num is composed of exactly 2 hexadecimal characters. Likewise, expected values belong to an extended (8-bit) ASCII set.
A single backslash.
A double quote.
If no rule above applies, this is an error.
All the other characters are plain characters and are to be included in the string. In particular, multi-line strings are allowed.
Like C comments, but can be nested:
Code /* Comment /* Nested comment */ Comment */ Code
Identifiers start with a letter, followed by any number of alphanumeric characters plus the underscore. Identifiers are case sensitive. Moreover, the special _main string is also accepted as a valid identifier.
id ::= letter { letter | digit | _ } | _main letter ::= a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z digit ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
There are only integers in Tiger.
integer ::= digit { digit } op ::= + | - | * | / | = | <> | > | < | >= | <= | & | |
Any other character is invalid.