TC-3 Goals

Things to learn during this stage that you should remember:

The Command design pattern

The Task module is based on the Command design pattern. See The src/task Directory.

Writing a Container Class Template

Class template are most useful to implement containers such as misc::scoped_map.

Using Methods From Parent Classes

super_type and qualified method invocation to factor common code.

Template Specialization

Although quite different in nature, types and functions are processed in a similar fashion in a Tiger compiler:

  • The first needs to visit the headers (to introduce the names in the scope, and to check that names are only defined once).

  • Then, the second needs to visit the bodies (to bind the names to actual values). We use templates and template specialization to factor this. See also the Template Method.

Concepts

Concepts were introduced in C++20. Essentially, a Concept is a named set of constraints/requirements evaluated at compile-time. Among other things, they are used to perform type-checking on templated code. See concepts documentation by cppreference.

Streams’ internal extensible arrays

C++ streams allows users to dynamically store information within themselves thanks to std::ios::xalloc, std::stream::iword, and std::stream::pword (see ios_base documentation by cppreference). Indented output can use it directly in operator<<, see lib/misc/indent.* and lib/misc/test-indent.cc. More generally, if you have to resort to using print because you need additional arguments than the sole stream, consider using this feature instead.

Use this feature so that the PrettyPrinter can be told from the std::ostream whether bindings and escapes should be displayed.