At the top level, these objects represent all the input files.
A Hier instance represents the hierarchy
of taxonomic levels: class, order, family, and so on.
The Hier instance is a container
class for a sequence of Rank objects,
one representing each taxonomic level.
A Txny instance represents both sets of
names in the taxonomy: scientific names and bird codes.
It is a container class for instances of the next two
classes, TaxaTree and AbTab.
A TaxaTree represents the set of all
taxa, structured as a tree.
An AbTab instance contains the symbol
table for form codes. It is a container class for
instances of class AbSym, each of
which represents one form code.
In general, then, the task of nomcompile3 is to read all the input files and incorporate them into these instances, and then use the instances to generate all the output files.
A background in the construction of compilers and
assemblers will be useful in understanding this program.
In particular, the structure of the .alt
file has the classic forward reference
problem: some of the codes refer to other
codes that have not yet been seen.
The classic technique for solving the forward reference problem is to build a symbol table—a structure containing an entry for every name that has been used so far, even though some names have not yet been defined.
Once all the names have been processed, we must make a pass through the symbol table to insure that all referenced symbols have been defined.
The symbol table entries are instances of a class named
AbSym. Each instance contains two
attributes: .abbr, the bird code as a
string, and .binding, which describes the
definition of that bird code, if one has been encountered.
The .binding attribute is initially set to
None. When a definition of that code is
encountered, the .binding attribute is set
to an instance derived from the abstract class AbBind. The various concrete classes derived from
AbBind represent the different kinds of
definitions of a bird code:
A StdBind instance represents a
connection between this bird code and one of the
standard taxa from the .std file.
Such instances arise from two different sources.
Each species defined in the .std file
will have a code. However, some of the lines in
the .alt file refer specific codes
to higher taxa.
An EqBind instance represents a
deprecated bird code that points to a different code
that is preferred.
A CollBind instance represents a
collision form, that is, multiple names that would
normally all abbreviate to the same code using the
standard abbreviation rules.
Here, then, is an entity-relationship diagram that depicts the relationships among these classes.