TC-4 Options
These are features that you might want to implement in addition to the core features.
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."666" = if 000 then 333 else "666"$ 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-5 and TC-L 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 the next item).