# Chapter 1: Toy Tutorial Introduction
+[TOC]
+
This tutorial runs through the implementation of a basic toy language on top of
MLIR. The goal of this tutorial is to introduce the concepts of MLIR, and
especially how *dialects* can help easily support language specific constructs
codegen infrastructure. This tutorial is based on the model of the
[LLVM Kaleidoscope Tutorial](https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html).
+## The Chapters
+
This tutorial is divided in the following chapters:
- [Chapter #1](Ch-1.md): Introduction to the Toy language, and the definition
# Chapter 3: High-level Language-Specific Analysis and Transformation
+[TOC]
+
Creating a dialect that closely represents the semantics of an input language
enables analyses, transformations and optimizations in MLIR that require high
level language information and are generally performed on the language AST. For
Further details on the declarative rewrite method can be found at
[Table-driven Declarative Rewrite Rule (DRR)](../../DeclarativeRewrites.md).
+
+In this chapter, we saw how to use certain core transformations through always
+available hooks. In the [next chapter](Ch-4.md), we will see how to use generic
+solutions that scale better through Interfaces.
# Chapter 4: Enabling Generic Transformation with Interfaces
+[TOC]
+
## Background: Grappling with an Extensible IR
Through dialects, MLIR allows for the representation of many different levels of
Next we define the interface methods that the operations will need to provide.
An interface method is comprised of: a description, a c++ return type in string
form, a method name in string form, as well as a few optional components
-depending on the need. See the [ODS
-documentation]](../../OpDefinitions.md#operation-interfaces) for more
+depending on the need. See the
+[ODS documentation](../../OpDefinitions.md#operation-interfaces) for more
information.
```.td
# Chapter 5 - Partial Lowering to Lower-Level Dialects for Optimization
+[TOC]
+
At this point, we are eager to generate actual code and see our Toy language
taking life. We will obviously use LLVM to generate code, but just showing the
LLVM builder interface wouldn't be very exciting here. Instead, we will show how
# Chapter 6 - Lowering to LLVM and CodeGeneration
+[TOC]
+
In the [previous chapter](Ch-5.md), we introduced the
[dialect conversion](../../DialectConversion.md) framework and partially lowered
many of the `Toy` operations to affine loop nests for optimization. In this
-emit=llvm to compare the various levels of IR involved. Also try options like
[--print-ir-after-all](../../WritingAPass.md#ir-printing) to track the evolution
of the IR throughout the pipeline.
+
+So far, we have worked with primitive data types. In the
+[next chapter](Ch-7.md), we will add a composite `struct` type.