Adding features

We want to add some more features to the compiler, to make it more robust.

Configuration
Allows the compiler’s user to configure the compiler in various ways. For example, to enable / disable optimization or to provide more verbose output.
Logging
The compiler can keep a log of its actions and write to the log as the compiler proceeds. The log can be helpful for the compiler user (and the compiler implementer!) if something goes wrong during compilation.
State
As our compiler implementation gets more advanced, we will need to start keeping track of information that will change over the course of compilation (e.g., type information).
Error handling
We would like our compiler to have robust error handling. Ideally, a compilation error would not cause the whole program to crash.

For each feature, we create a data type that stores the information we need to implement the feature. For now, we will define placeholder types:

data CompilerConfiguration = CompilerConfiguration
data CompilerLog = CompilerLog
data CompilerState = CompilerState
data CompilerError = CompilerError

To use each feature, our compiler must have access to the data for that feature. We will start modifying our design to add each of these features, one at a time.