BENCH parser

The header <lorina/bench.hpp> implements methods to parse the BENCH format.

The class lorina::bench_reader provides the following public member functions.

Function

Description

on_input(name)

Callback method for parsed input

on_output(name)

Callback method for parsed output

on_gate(inputs, output, type)

Callback method for parsed gate

on_assign(input, output)

Callback method for parsed gate assignment

The following reader functions are available.

Function
Description

read_bench

Reader function for the BENCH format.

read_bench

Reader function for BENCH format.
inline return_code lorina::read_bench(std::istream &in, const bench_reader &reader, diagnostic_engine *diag = nullptr)

Reader function for the BENCH format.

Reads BENCH format from a stream and invokes a callback method for each parsed primitive and each detected parse error.

Parameters
  • in – Input stream

  • reader – A BENCH reader with callback methods invoked for parsed primitives

  • diag – An optional diagnostic engine with callback methods for parse errors

Returns

Success if parsing has been successful, or parse error if parsing has failed

inline return_code lorina::read_bench(const std::string &filename, const bench_reader &reader, diagnostic_engine *diag = nullptr)

Reader function for BENCH format.

Reads BENCH format from a file and invokes a callback method for each parsed primitive and each detected parse error.

Parameters
  • filename – Name of the file

  • reader – A BENCH reader with callback methods invoked for parsed primitives

  • diag – An optional diagnostic engine with callback methods for parse errors

Returns

Success if parsing has been successful, or parse error if parsing has failed