Code to Models

Zig Experiments
Login

Zig Experiments

Zig Experiments

Recently I have been performing experiments in a few areas using the Zig programming language. The purpose of these experiments is to evaluate Zig as a potential implementation language for Part II of the book. Work on Part II will begin soon.

The overall goal of the experiments was to implement a minimal set of data management mechanisms.

The first experiment uses adjacency matrices as a means of navigating xUML relationships. The following are unversioned files available for convenience:

The second experiment is a Robin Hood hashing scheme for creating an index on an array. The hash table can be used to enforce identity constraints and blind searches based on identifying attribute values. The following are unversioned files available for convenience:

The third experiment created an dynamic allocation mechanism for an array. The intent here is to be able to treat the elements of an array as a set of instances whose population varies over time. The example program in this experiment integrates the adjacency matrix for relationships and the hash table for identifying attributes into a simplistic relvar management scheme. The following are unversioned files available for convenience:

Overall, the experiments have been successful. Zig contains constructs that support type-specfic data structures and processing without resorting to pre-processors or code generation. Although we still envision using code generation as part of the translation of an xUML model to code, Zig would allow pushing much of the detailed type introspection required to achieve strictly typed code to the compiler to create, leaving the code generation from the model as a more strictly declarative undertaking. We have not made final decision, but Zig holds much promise in this area.