TC-4 Options
This section documents possible extensions you could implement in TC-4.
type::Error
One problem is that type error recovery can generate false errors. For instance our compiler usually considers that the type for incorrect constructs is
Int, which can create cascades of errors.is_devil.tig"666" = if 000 then 333 else "666"tc -T is_devil.tig$ tc -T is_devil.tig is_devil.tig:1.9-34: type mismatch then clause type: int else clause type: string is_devil.tig:1.1-34: type mismatch left operand type: string right operand type: int $ echo $? 5One 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 toast::Error.
Various Desugaring
See TC-D, Removing the syntactic sugar from the Abstract Syntax Tree, for more details. This is quite an easy option, and a very interesting one. Note that implementing desugaring makes TC-L and TC-5 easier.
Renaming object-oriented constructs
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,object::Renamer, shall 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 TC-O, Desugaring object constructs.