These are features that you might want to implement in addition to the core features.
One problem is that type error recovery can generate false errors. For
instance our compiler usually considers that the type for incorrect
Int, which can create cascades of errors:
"666" = if 000 then 333 else "666"
$ tc -T is_devil.tig error→is_devil.tig:1.9-34: type mismatch error→ then clause type: int error→ else clause type: string error→is_devil.tig:1.1-34: type mismatch error→ left operand type: string error→ right operand type: int ⇒5
One means to avoid this issue consists in introducing a new type,
type::Error, that the type checker would never complain about.
This can be a nice complement to
See TC-D, for more details. This is quite an easy option, and a very interesting one. Note that implementing desugaring makes TC-5 easier.
If you felt TC-D was easy, then implementing bounds checking should be easy too. See TC-B.
See TC-A, for a description of this ambitious option.
Like TC-R, this task consists in writing a visitor
renaming AST nodes holding names (either defined or used), this time
with support for object-oriented constructs (option
--object-rename). This visitor,
also update named types (
type::Named) and collect the names of
all (renamed) classes. This option is essentially a preliminary step of
TC-O (see the next item).
If your compiler is complete w.r.t. object constructs (in particular,
the type-checking and the renaming of objects is a requirement), then
you can implement
this very ambitious option, whose goal is to convert a Tiger program
with object constructs into a program with none of them (i.e., in the
subset of Tiger called Panther). This work consists in
object::DesugarVisitor and implementing the
--object-desugar option. See TC-O.