Arithmetic Stream Handler API

Table of Contents

Include this API as

#include <wtk/ArithmeticStreamHandler.h>

Members of this API live in the following namespace

namespace wtk { ...

This API is parameterized on a Number_T template. Number_T should be integer-like enough to be parsed from a string. This API is abstract and implemented by parsers for various IR formats.

template<typename Number_T> class ArithmeticStreamHandler

The wtk::ArithmeticStreamHandler<Number_T> is a virtual class for the user to implement with callbacks for the Parser API to use when stream parsing.

virtual void setLineNumber(size_t const line)

If the Parser supports line-numbering, it will use this callback to set the current line number before a gate’s callback is invoked.

virtual void setLineNum(size_t const line);

virtual void handleInstance(wtk::index_t const idx)

Called when an @instance directive is reached.

virtual void handleInstance(wtk::index_t const idx);

virtual void handleShortWitness(wtk::index_t const idx)

Called when an @short_witness directive is reached.

virtual void handleShortWitness(wtk::index_t const idx);

virtual void handleAdd(wtk::index_t const out, wtk::index_t const left, wtk::index_t const right)

Called when an @add directive is reached.

virtual void handleAdd(wtk::index_t const out, wtk::index_t const left, wtk::index_t const right);

virtual void handleMul(wtk::index_t const out, wtk::index_t const left, wtk::index_t const right)

Called when an @mul directive is reached.

virtual void handleMul(wtk::index_t const out, wtk::index_t const left, wtk::index_t const right);

virtual void handleAddC(wtk::index_t const out, wtk::index_t const left, Number_T const right)

Called when an @addc directive is reached.

virtual void handleAddC(wtk::index_t const out, wtk::index_t const left, Number_T const right);

virtual void handleMulC(wtk::index_t const out, wtk::index_t const left, Number_T const right)

Called when an @mulc directive is reached.

virtual void handleMulC(wtk::index_t const out, wtk::index_t const left, wtk::index_t const right);

virtual void handleAssign(wtk::index_t const out, Number_T const val)

Called when a constant assignment directive is reached.

virtual void handleAssign(wtk::index_t const out, Number_T const val);

virtual void handleCopy(wtk::index_t const out, wtk::index_t const in)

Called when a copy directive is reached.

virtual void handleCopy(wtk::index_t const out, wtk::index_t const in);

virtual void handleAssertZero(wtk::index_t const in)

Called when an @assert_zero directive is reached.

virtual void handleAssertZero(wtk::index_t const in);

virtual void handleDeleteSingle(wtk::index_t const in)

Called when a @delete directive with a single argument is reached.

virtual void handleDeleteSingle(wtk::index_t const in);

virtual void handleDeleteRange(wtk::index_t const first, wtk::index_t const last)

Called when a @delete directive with a range argument is reached. The range is inclusive on both ends.

virtual void handleDeleteRange(wtk::index_t const first, wtk::index_t const last);

virtual void handleEnd()

Called after the last directive is reached.

virtual void handleEnd();