This is the interface between the front and backends of the generator. The GUI
and the console interface both talk to this module, and in turn, this module
talks to the input file parsers and the surface realisation engine.

Main interface

Program state and configuration

The program state consists of its configuration options and abstract,
cleaned up representations of all the data it's had to load into memory
(tree schemata files, lexicon files, etc). The intention is for the
state to stay static until the next time something triggers some file
loading.

In addition to the results, this returns a generator state. The latter is
is mostly useful for debugging via the graphical interface.
Note that we assumes that you have already loaded in your grammar and
parsed your input semantics.

GeniResults is the outcome of running GenI on a single input semantics.
Each distinct result is returned as a single GeniResult (NB: a single
result may expand into multiple strings through morphological
post-processing),

getTraces is most likely useful for grammars produced by a
metagrammar system. Given a tree name, we retrieve the `trace'
information from the grammar for all trees that have this name. We
assume the tree name was constructed by GenI; see the source code for
details.

Loading things

We have one master function that loads all the files GenI is expected to
use. This just calls the sub-loaders below, some of which are exported
for use by the graphical interface. The master function also makes sure
to complain intelligently if some of the required files are missing.

The file loading functions all work the same way: we load the file,
and try to parse it. If this doesn't work, we just fail in IO, and
GenI dies. If we succeed, we update the program state passed in as
an IORef.