Type Rules for the TL09 Language

Informal Type Rules

  1. The operands of all OP2, OP3, and OP4 operators must be integers
  2. The OP2 and OP3 operators create an integer result.
  3. The OP4 operators create boolean results.
  4. All variables must be declared with a particular type.
  5. The left-hand of assignment must be a variable, and the right-hand side must be an expression of the variable's type.
  6. When used as a value, a variable's type is its declared type.
  7. Only integer variables may be assigned the result of READINT.
  8. WRITEINT's expression must evaluate to an integer.
  9. The expression guarding IF-statements and WHILE-loops must be boolean.
  10. The literals "FALSE" and "TRUE" are boolean constants.
  11. The literal numbers -2147483648 through 2147483647 are integer constants. Numbers outside of that range should be flagged as illegal.

Errata/Clarifications