TC-O, Desugaring object constructs
TC-O is an additional assignment.
At the end of this stage, the compiler must be able to desugar object constructs
into plain Tiger without objects, a.k.a. Panther. This feature is triggered by
the option --object-desugar
or can be combined using --c-object
.
Do not forget that you need to complete and write all missing parts of the
object support (parser, ast, binder, type-checker, etc…). Make sure that all
of these are correctly working before starting this assignment.
This a very hard assignment. If you plan to work on it, start with very simple programs, and progressively add new desugaring patterns. Be sure to keep a complete test suite to cover all cases and avoid regressions.
Achieving a faithful and complete translation from Tiger to Panther requires a lot of work. Even the reference implementation of the object-desugar pass (about 1,000 lines of code) is not perfect, as some inputs may generate invalid Tiger code after desugaring objects (in particular when playing with scopes).