1. | An identifier is a sequence of letters and digits; the first character must be a letter. All identifiers are returned as the same token type. The string of each identifier is returned as the attribute value of the token. |
2. |
The following identifiers are reserved for use as keywords, and may not be
used otherwise:
else exit int if read return while write Each keyword is returned as a different token. No attribute value is returned with a keyword. |
3. | An integer constant consists of a sequence of digits. All integer constants are returned as the same token type. The integer value of each integer constant is returned as the attribute value of the token. |
4. |
Operators include
+ - * / % == != > >= < <= && || ! = ; , ( ) { } Each operator is returned as a different token. No attribute value is returned with an operator. |
5. | White spaces. Blanks, tabs, and newlines are ignored except as they serve to separate tokens. |
6. | Comments. A comment starts with the characters -- and ends with a newline. Comments are ignored except as they serve to separate tokens. |