Skip to content

Overall design

Matt Windsor edited this page Jan 4, 2019 · 7 revisions

This page details the overall structural design of act at time of writing.

NOTE: act is still in its infancy, and this design is subject to heavy change.

Module structure

act consists of the following modules, from bottom to top:

  • utils: miscellaneous utilities shared by everything else;
  • lib: the actual compiler-testing framework;
  • abstract: the abstract program model;
  • litmus: support for the litmus tests format;
  • the architecture-specific modules:
    • x86: Intel x86;
    • c: C (which technically isn't an architecture, but shares a lot of the same infrastructure);
  • bin: the user-facing top-level and glue code.

utils

This contains various things that aren't necessarily act-specific, but haven't yet been generalised out of act.

lib

This module contains the following well-defined pieces of functionality (and some other bits that need to be organised):

Language support

  • the language frontend module (Frontend), which contains generic parsing and lexing logic used by the language parsers;
  • the language interface (Language*), which gives signatures and functors for building up interfaces between act and assembly languages;

Assembly analysis

  • the sanitiser (Sanitiser*), which lowers assembly programs into a Litmus-ready format;
  • the explainer (Explainer), which dumps out the basic analysis for an assembly program, and thus tells the user how act is making its various sanitisation decisions;
  • the assembly job runner (Asm_job), which adds a layer on top of Sanitiser and Explainer that handles general file I/O and bookkeeping;

Compilation

  • the compiler interface (Compiler*), which gives signatures and functors for building up interfaces between act and compilers, as well as defining and parsing compiler specs;
  • the compiler tester (Tester), which implements most of the act test command;

Miscellanea

  • various modules that implement the configuration system (Config, Spec, and parts of Compiler and Machine).
  • various utility modules (like Src_dst and Output) that aren't necessarily coherent groups of act functionality, but are too act-specific to move to utils.

Abstract program model

See the main page.

Litmus language support

See the main page.

Language-specific modules

These modules contain the language frontends (lexers and parsers), as well as very basic semantic analysis, for the various languages act understands (at time of writing, x86 and C).

Generally, they follow the same layout as the parts of lib they implement: for example, language frontends will usually appear in the Frontend module, language analysis in the Language module, and so on.

bin

bin contains the act top-level, as well as some glue code that connects the language-independent bits in lib with the language-specific bits in x86 etc.

Key modules include:

  • Main: the entry point and command handler for the act top-level;
  • A module for each of the subcommands, named after the command;
  • Common: glue code shared by various subcommands, but not forming a coherent-enough module to separate out;
  • Language_support: most of the aforementioned glue code (more apt name ideas welcomed);
  • Standard_args: boilerplate for parsing the standard flags (and other common-but-not-standard flags).

See also

Clone this wiki locally