IRParameters API

Include this API as

#include <wtk/Parser.h>

Members of this API live in the following namespace

namespace wtk { ...

This header defines some of the front-matter parameters of the IR. Generally these parameters will be provided by the Parser API.

enum class Resource

An enumeration of the various resources an IR file may be.

  • wtk::Resource::relation

  • wtk::Resource::instance

  • wtk::Resource::shortWitness

  • wtk::Resource::invalid (a default or error condition)

struct GateSet

This structure defines the allowable gates of a relation. It is split along two varieties of gates arithmetic or boolean, each of which may be taken as a "cannonical" set (e.g. all gates enabled) or a subset.

enum { …​ } gateSet

This indicates which variety of gates are used. and has the following values

  • wtk::GateSet::arithmetic

  • wtk::GateSet::boolean

  • wtk::GateSet::invalid (a default or error conditions)

enum {
  arithmetic,
  boolean,
  invalid
} gateSet = invalid;

SubSet definitions (union)

This unnamed union attribute defines sub sets of either of the gate set varieties. As a union, only attributes of the active/correct gate set may be used.

Arithmetic Subsets (struct)

The following flags indicate if an arithmetic gate is allowable.

  • bool enableAdd indicates if @add is allowed.

  • bool enableAddC indicates if @addc is allowed.

  • bool enableMul indicates if @mul is allowed.

  • bool enableMulC indicates if @mulc is allowed.

Boolean Subsets (struct)

The following flags indicate if a boolean gate is allowable.

  • bool enableXor indicates if @xor is allowed.

  • bool enableAnd indicates if @and is allowed.

  • bool enableNot indicates if @not is allowed.

bool cannonical() const

A "cannonical" gate set is one which has all gates of the variety enabled. This function indicates if this GateSet is cannonical.

bool cannonical() const;

struct FeatureToggles

The IR allows structural features to be disabled. At the extremities "IR Simple" indicates that no features are enabled, while "IR Complete" indicates that all features are enabled.

bool functionToggle

This flag indicates that named functions are enabled, and that anonymous functions are allowed (except for the bodies of other enabled features).

bool functionToggle = false;

bool forLoopToggle

This flag indicates that for loops are enabled.

bool forLoopToggle = false;

bool switchCaseToggle

This flag indicates that switch statements are enabled.

bool switchCaseToggle = false;

bool simple() const

This method checks if these feature toggles form IR-Simple (all features disabled).

bool simple() const;

bool complete() const

This method checks if these feature toggles form IR-Complete (all features enabled).

bool complete() const;