How to register a dialect?

Registering dialects is done in the C++ code. In this case, the toy tutorial is implementing its opt tool in llvm-project/toyc.cpp at main · llvm/llvm-project · GitHub

This is then used as shown here: Chapter 2: Emitting Basic MLIR - MLIR