Remove duplicate declaration of FileResolver.
Stop asserting that formatters have `reference` and `build` functions.

`reference` isn't even called directly, and there are a whole bunch of other methods that are called directly that we don't even check.
Improve and fill out the inline documentation.

We also just refer to the global names for objects in ast-types.
Inline an unnecessary variable.
Fix whitespace.
Create a base class for formatters.

This class is almost entirely abstract and requires subclasses to implement their interface.