Possible improvements include:
Runtime
classprint
, getchar
and so forth. This stage
requires to know the signature of these builtins to type check their
uses, the stage T5 need the signature to implement correctly the call
protocol, and some other parts of the compiler might need them.
It is a bad designed that the knowledge about these builtins is
scattered in various places, but to avoid departing too much from
Appel's modelisation1, we kept it this way. You might want to make one
anyway.
function substring (string: string, first: int, count: int) : string = __builtin "substring" /* ... */
This would keep all things together, and would make it easier to implement extensions in the language. For instance, one could add:
function abort () = __builtin "abort"
Walking that track goes beyond the simplicity and minimality that the Tiger Projects aims at for (generalist) first year students.
[1] This statement is unfair to Andrew Appel: since in his modelisation type checking and translation are performed in a single step, the information about the builtins remains in a single place.