6 Implementation
Our implementation of Hancock consists of a compiler that translates
Hancock code into plain C code, which is then compiled and linked with
a runtime system to produce executable code. We modified ckit,
a C-to-C
translator written in ML[SCHO99] to parse Hancock and translate the
resulting extended parse tree into abstract syntax for plain C. The
compiler generates code for the various Hancock operators and clauses
and for the main routine. The runtime system, which is written
in C, manages the representation of Hancock data on-disk and in
memory. It converts between these representations as necessary and it
mediates all access to the data.
We were able to build Hancock relatively quickly by leveraging other
people's software. In particular, we built the compiler on top of ckit, an existing C-to-C translator[SCHO99] written for the purpose of
building compilers for C-based domain-specific languages. We also used a
collection of libraries: msort[Lin99, MMB92],
sfio[KV91], and vmalloc[Vo96]. Msort provides an external
sorter and sfio supports 64-bit files, making these two libraries particularly
useful in addressing issues of scale.